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

This commit is contained in:
Eric Pouech 2011-04-23 22:20:54 +02:00 committed by Alexandre Julliard
parent f1f223d001
commit 0b9ddd1ce4
1 changed files with 9 additions and 1 deletions

View File

@ -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 );