returning on null check

This commit is contained in:
Bimba Shrestha 2020-04-03 13:39:02 -07:00
parent d598c88fb3
commit 1d267dc5d6

View File

@ -100,6 +100,8 @@ static char* readFile(const char* filename, size_t* size) {
buf = malloc(*size);
if (buf == NULL) {
fprintf(stderr, "malloc failed\n");
fclose(f);
return NULL;
}
bytes_read = fread(buf, 1, *size, f);