[PATCH] [services]: be sure to unlock the current database in all error cases in service_start_process

Eric Pouech eric.pouech at orange.fr
Sat Apr 23 15:20:54 CDT 2011




A+
---

 0 files changed, 0 insertions(+), 0 deletions(-)


diff --git a/programs/services/services.c b/programs/services/services.c
index eab532f..5d0e4be 100644
--- a/programs/services/services.c
+++ b/programs/services/services.c
@@ -575,7 +575,11 @@ static DWORD service_start_process(struct service_entry *service_entry, HANDLE *
 
     size = ExpandEnvironmentStringsW(service_entry->config.lpBinaryPathName,NULL,0);
     path = HeapAlloc(GetProcessHeap(),0,size*sizeof(WCHAR));
-    if (!path) return ERROR_NOT_ENOUGH_SERVER_MEMORY;
+    if (!path)
+    {
+        service_unlock(service_entry);
+        return ERROR_NOT_ENOUGH_SERVER_MEMORY;
+    }
     ExpandEnvironmentStringsW(service_entry->config.lpBinaryPathName,path,size);
 
     if (service_entry->config.dwServiceType == SERVICE_KERNEL_DRIVER)
@@ -590,6 +594,7 @@ static DWORD service_start_process(struct service_entry *service_entry, HANDLE *
             if (!GetBinaryTypeW( path, &type ))
             {
                 HeapFree( GetProcessHeap(), 0, path );
+                service_unlock(service_entry);
                 return GetLastError();
             }
             if (type == SCS_32BIT_BINARY) GetSystemWow64DirectoryW( system_dir, MAX_PATH );
@@ -598,7 +603,10 @@ static DWORD service_start_process(struct service_entry *service_entry, HANDLE *
         len = strlenW( system_dir ) + sizeof(winedeviceW)/sizeof(WCHAR) + strlenW(service_entry->name);
         HeapFree( GetProcessHeap(), 0, path );
         if (!(path = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
+        {
+            service_unlock(service_entry);
             return ERROR_NOT_ENOUGH_SERVER_MEMORY;
+        }
         lstrcpyW( path, system_dir );
         lstrcatW( path, winedeviceW );
         lstrcatW( path, service_entry->name );




More information about the wine-patches mailing list