registrybackend: fix possible mem leak

If the parameters do not validate we would leak the memory.
This commit is contained in:
Ignacio Casal Quinteiro 2016-01-26 11:42:05 +01:00
parent 305a9b12c9
commit 8f7aa273de

View File

@ -388,17 +388,19 @@ typedef struct
} RegistryCacheItem;
static GNode *
registry_cache_add_item (GNode *parent,
gchar *name,
RegistryValue value,
gint ref_count)
registry_cache_add_item (GNode *parent,
gchar *name,
RegistryValue value,
gint ref_count)
{
RegistryCacheItem *item = g_slice_new (RegistryCacheItem);
RegistryCacheItem *item;
GNode *cache_node;
g_return_val_if_fail (name != NULL, NULL);
g_return_val_if_fail (parent != NULL, NULL);
item = g_slice_new (RegistryCacheItem);
/* Ref count should be the number of watch points above this node */
item->ref_count = ref_count;
@ -413,6 +415,7 @@ registry_cache_add_item (GNode *parent,
cache_node = g_node_new (item);
g_node_append (parent, cache_node);
return cache_node;
}