[ros-diffs] [cwittich] 36410: fix heap corruption when lpStringToFind is NULL Fix for Coverity error CID: 775.

cwittich at svn.reactos.org cwittich at svn.reactos.org
Tue Sep 23 08:55:05 CEST 2008


Author: cwittich
Date: Tue Sep 23 01:55:05 2008
New Revision: 36410

URL: http://svn.reactos.org/svn/reactos?rev=36410&view=rev
Log:
fix heap corruption when lpStringToFind is NULL
Fix for Coverity error CID: 775.

Modified:
    trunk/reactos/dll/win32/kernel32/misc/actctx.c

Modified: trunk/reactos/dll/win32/kernel32/misc/actctx.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/actctx.c?rev=36410&r1=36409&r2=36410&view=diff
==============================================================================
--- trunk/reactos/dll/win32/kernel32/misc/actctx.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/misc/actctx.c [iso-8859-1] Tue Sep 23 01:55:05 2008
@@ -30,7 +30,7 @@
     )
 {
     BOOL bRetVal;
-    LPWSTR lpStringToFindW;
+    LPWSTR lpStringToFindW = NULL;
 
     /* Convert lpStringToFind */
     if (lpStringToFind)
@@ -47,7 +47,8 @@
                                         ReturnedData);
 
     /* Clean up */
-    RtlFreeHeap(GetProcessHeap(), 0, (LPWSTR*) lpStringToFindW);
+    if (lpStringToFindW)
+        RtlFreeHeap(GetProcessHeap(), 0, (LPWSTR*) lpStringToFindW);
 
     return bRetVal;
 }



More information about the Ros-diffs mailing list