RagePhoto.c: fix potential memory issue
This commit is contained in:
parent
6066d92ee9
commit
24e0d9c03e
1 changed files with 2 additions and 0 deletions
|
@ -583,6 +583,8 @@ bool ragephoto_loadfile(ragephoto_t instance_t, const char *filename)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
char *data = (char*)(malloc(fileSize));
|
char *data = (char*)(malloc(fileSize));
|
||||||
|
if (!data)
|
||||||
|
return false;
|
||||||
const size_t fileRsize = fread(data, 1, fileSize, file);
|
const size_t fileRsize = fread(data, 1, fileSize, file);
|
||||||
fclose(file);
|
fclose(file);
|
||||||
if (fileSize != fileRsize) {
|
if (fileSize != fileRsize) {
|
||||||
|
|
Loading…
Reference in a new issue