RagePhoto.c: fix potential memory issue

This commit is contained in:
Syping 2023-06-07 06:09:37 +02:00
parent 6066d92ee9
commit 24e0d9c03e
1 changed files with 2 additions and 0 deletions

View File

@ -583,6 +583,8 @@ bool ragephoto_loadfile(ragephoto_t instance_t, const char *filename)
return false;
}
char *data = (char*)(malloc(fileSize));
if (!data)
return false;
const size_t fileRsize = fread(data, 1, fileSize, file);
fclose(file);
if (fileSize != fileRsize) {