returning on null check

dev
Bimba Shrestha 2020-04-03 13:39:02 -07:00
parent d598c88fb3
commit 1d267dc5d6
1 changed files with 2 additions and 0 deletions

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);