summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2016-08-16 21:14:37 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2016-08-16 21:14:37 +0200
commitcbb239669243596719d680c23245fae8381f604d (patch)
tree0149c2ee955d47b9aed1d85cf096db3e98198e39
parentfccb580a2d356a0f69a421c117d36345c73b98b3 (diff)
PhotoRec: fix memory leak in file_exe_ressource()
Bug found using Coverity Scan
-rw-r--r--src/file_exe.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/file_exe.c b/src/file_exe.c
index 896a395..fab7e18 100644
--- a/src/file_exe.c
+++ b/src/file_exe.c
@@ -407,10 +407,16 @@ static void file_exe_ressource(FILE *file, const unsigned int base, const unsign
unsigned int off;
unsigned int len;
if(fseek(file, base + (le32(rsrc_entry->Pos) & 0x7fffffff), SEEK_SET)<0)
+ {
+ free(rsrc_entries);
return ;
+ }
buffer_size=fread(buffer, 1, sizeof(buffer), file);
if(buffer_size<16)
+ {
+ free(rsrc_entries);
return ;
+ }
off=buffer[0]+ (buffer[1]<<8) + (buffer[2]<<16) + (buffer[3]<<24);
len=buffer[4]+ (buffer[5]<<8) + (buffer[6]<<16) + (buffer[7]<<24);
{