From 24e0d9c03eac5dc61c765b136d167f5935411b7f Mon Sep 17 00:00:00 2001 From: Syping Date: Wed, 7 Jun 2023 06:09:37 +0200 Subject: [PATCH] RagePhoto.c: fix potential memory issue --- src/RagePhoto.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/RagePhoto.c b/src/RagePhoto.c index c20ee07..139c9f2 100644 --- a/src/RagePhoto.c +++ b/src/RagePhoto.c @@ -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) {