registrybackend: do not leak key and event if it cannot add the watch

This commit is contained in:
Ignacio Casal Quinteiro 2016-01-26 12:53:56 +01:00
parent a92d97ff1f
commit 31aab1bd42

View File

@ -1933,7 +1933,11 @@ g_registry_backend_subscribe (GSettingsBackend *backend,
/* The actual watch is added by the thread, which has to re-subscribe each time it
* receives a change. */
if (!watch_add_notify (self, event, hpath, g_strdup (key_name)))
g_atomic_int_inc (&self->watch->watches_remaining);
{
g_atomic_int_inc (&self->watch->watches_remaining);
RegCloseKey (hpath);
CloseHandle (event);
}
}
static void