Check fread return value
This commit is contained in:
parent
7bf127572c
commit
a698d28415
1 changed files with 6 additions and 1 deletions
|
@ -206,7 +206,12 @@ char * os_readfile(const char *name, size_t *len)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
fread(buf, 1, *len, f);
|
||||
if (fread(buf, 1, *len, f) != *len) {
|
||||
fclose(f);
|
||||
os_free(buf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
|
||||
return buf;
|
||||
|
|
Loading…
Reference in a new issue