Eric Pouech : services: Be sure to unlock the current database in all error cases in service_start_process .

Alexandre Julliard julliard at winehq.org
Mon Apr 25 12:47:12 CDT 2011


Module: wine
Branch: master
Commit: 0b9ddd1ce4b261ce680dd93e8cce9a0a45895c98
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0b9ddd1ce4b261ce680dd93e8cce9a0a45895c98

Author: Eric Pouech <eric.pouech at orange.fr>
Date:   Sat Apr 23 22:20:54 2011 +0200

services: Be sure to unlock the current database in all error cases in service_start_process.

---

 programs/services/services.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 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-cvs mailing list