services: Hold scmdatabase lock while checking marked_for_delete.

Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Sebastian Lackner 2016-03-16 04:30:39 +01:00 committed by Alexandre Julliard
parent 4a3d712608
commit 38a09f9c7b

View file

@ -456,13 +456,15 @@ struct service_entry *scmdatabase_find_service_by_displayname(struct scmdatabase
void release_service(struct service_entry *service)
{
struct scmdatabase *db = service->db;
scmdatabase_lock(db);
if (InterlockedDecrement(&service->ref_count) == 0 && is_marked_for_delete(service))
{
scmdatabase_lock(service->db);
scmdatabase_remove_service(service->db, service);
scmdatabase_unlock(service->db);
scmdatabase_remove_service(db, service);
free_service_entry(service);
}
scmdatabase_unlock(db);
}
static DWORD scmdatabase_create(struct scmdatabase **db)