changeset 9584:31126ea5cd36

Some free(NULL) found with njamd
author albeu
date Fri, 14 Mar 2003 17:42:21 +0000
parents e442209e6241
children 89a31cf91a05
files unrarlib.c
diffstat 1 files changed, 10 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/unrarlib.c	Fri Mar 14 17:19:19 2003 +0000
+++ b/unrarlib.c	Fri Mar 14 17:42:21 2003 +0000
@@ -293,11 +293,11 @@
 struct NewFileHeader NewLhd;
 struct BlockHeader BlockHead;
 
-UBYTE *TempMemory;                          /* temporary unpack-buffer      */
-char *CommMemory;
-
-
-UBYTE *UnpMemory;
+UBYTE *TempMemory = NULL;                          /* temporary unpack-buffer      */
+char *CommMemory = NULL;
+
+
+UBYTE *UnpMemory = NULL;
 char ArgName[NM];                           /* current file in rar archive  */
 char ArcFileName[NM];                       /* file to decompress           */
 
@@ -422,9 +422,9 @@
   }
 #endif
 
-  free(UnpMemory);                          /* free memory                  */
-  free(TempMemory);
-  free(CommMemory);
+  if(UnpMemory) free(UnpMemory);           /* free memory                  */
+  if(TempMemory) free(TempMemory);
+  if(CommMemory) free(CommMemory);
   UnpMemory=NULL;
   TempMemory=NULL;
   CommMemory=NULL;
@@ -432,7 +432,8 @@
 
   if(retcode == FALSE)
   {
-    free(temp_output_buffer);               /* free memory and return NULL  */
+    if(temp_output_buffer)                  /* free memory and return NULL  */
+      free(temp_output_buffer);
     temp_output_buffer=NULL;
     *(DWORD*)output=0;                      /* pointer on errors            */
     *size=0;