returning on null check
This commit is contained in:
@@ -100,6 +100,8 @@ static char* readFile(const char* filename, size_t* size) {
|
|||||||
buf = malloc(*size);
|
buf = malloc(*size);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
fprintf(stderr, "malloc failed\n");
|
fprintf(stderr, "malloc failed\n");
|
||||||
|
fclose(f);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes_read = fread(buf, 1, *size, f);
|
bytes_read = fread(buf, 1, *size, f);
|
||||||
|
|||||||
Reference in New Issue
Block a user