[EPSAPI]
authorPierre Schweitzer <pierre@reactos.org>
Sat, 5 Apr 2014 09:17:21 +0000 (09:17 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Sat, 5 Apr 2014 09:17:21 +0000 (09:17 +0000)
Fix double free in PsaCaptureSystemModules()
CID #1106329

svn path=/trunk/; revision=62614

reactos/lib/epsapi/enum/drivers.c

index fa87c54..9fdbe93 100644 (file)
@@ -100,6 +100,7 @@ PsaCaptureSystemModules(OUT PRTL_PROCESS_MODULES *SystemModules)
        ignore the buffer's content at this point, there's no point in a realloc,
        that could end up copying a large chunk of data we'd discard anyway */
     PsaiFree(psmModules);
+    psmModules = NULL;
     pTmp = PsaiMalloc(nSize);
 
     if(pTmp == NULL)
@@ -138,7 +139,7 @@ PsaCaptureSystemModules(OUT PRTL_PROCESS_MODULES *SystemModules)
   } while(0);
 #endif
   /* in case of failure, free the buffer */
-  if(!NT_SUCCESS(Status))
+  if(!NT_SUCCESS(Status) && psmModules != NULL)
   {
     PsaiFree(psmModules);
   }