[ADVAPI32]
authorPierre Schweitzer <pierre@reactos.org>
Thu, 3 Sep 2015 21:27:51 +0000 (21:27 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Thu, 3 Sep 2015 21:27:51 +0000 (21:27 +0000)
Fix memory leaks in case of failure

CID 1322129
CID 1322130

svn path=/trunk/; revision=68968

reactos/dll/win32/advapi32/service/sctrl.c

index e73c8e6..b3af2ae 100644 (file)
@@ -472,7 +472,10 @@ ScStartService(PACTIVE_SERVICE lpService,
                                            &ThreadParamsW->dwArgCount,
                                            &ThreadParamsW->lpArgVector);
         if (dwError != ERROR_SUCCESS)
+        {
+            HeapFree(GetProcessHeap(), 0, ThreadParamsW);
             return dwError;
+        }
         ThreadParamsW->lpServiceMain = lpService->ServiceMain.W;
         ThreadHandle = CreateThread(NULL,
                                     0,
@@ -500,7 +503,10 @@ ScStartService(PACTIVE_SERVICE lpService,
                                         &ThreadParamsA->dwArgCount,
                                         &ThreadParamsA->lpArgVector);
         if (dwError != ERROR_SUCCESS)
+        {
+            HeapFree(GetProcessHeap(), 0, ThreadParamsA);
             return dwError;
+        }
         ThreadParamsA->lpServiceMain = lpService->ServiceMain.A;
         ThreadHandle = CreateThread(NULL,
                                     0,