[SERVICES]
authorEric Kohl <eric.kohl@reactos.org>
Mon, 7 Mar 2011 20:25:28 +0000 (20:25 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Mon, 7 Mar 2011 20:25:28 +0000 (20:25 +0000)
Leave the critical section when the allocation of the control packet fails.

Bug spotted by hzlilx.

svn path=/trunk/; revision=50994

reactos/base/system/services/database.c

index f33d437..02afda3 100644 (file)
@@ -700,7 +700,10 @@ ScmControlService(PSERVICE Service,
                                                    HEAP_ZERO_MEMORY,
                                                    sizeof(SCM_CONTROL_PACKET) + (TotalLength * sizeof(WCHAR)));
     if (ControlPacket == NULL)
                                                    HEAP_ZERO_MEMORY,
                                                    sizeof(SCM_CONTROL_PACKET) + (TotalLength * sizeof(WCHAR)));
     if (ControlPacket == NULL)
+    {
+        LeaveCriticalSection(&ControlServiceCriticalSection);
         return ERROR_NOT_ENOUGH_MEMORY;
         return ERROR_NOT_ENOUGH_MEMORY;
+    }
 
     ControlPacket->dwControl = dwControl;
     ControlPacket->dwSize = TotalLength;
 
     ControlPacket->dwControl = dwControl;
     ControlPacket->dwSize = TotalLength;