From 258ef1b8b812ac5a7c5f0468b1fe5ab6a8f700a2 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Wed, 27 Jun 2012 16:38:35 +0200 Subject: [PATCH] Fix null-pointer dereference * In the corner case where we don't know about a collection/item but receive the CollectionChanged or ItemChanged signal, fix use of a null pointer --- library/secret-collection.c | 6 ++++-- library/secret-service.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/library/secret-collection.c b/library/secret-collection.c index d088d5b..da5cade 100644 --- a/library/secret-collection.c +++ b/library/secret-collection.c @@ -507,8 +507,10 @@ secret_collection_signal (GDBusProxy *proxy, g_mutex_unlock (&self->pv->mutex); - secret_item_refresh (item); - g_object_unref (item); + if (item) { + secret_item_refresh (item); + g_object_unref (item); + } } g_variant_unref (paths); diff --git a/library/secret-service.c b/library/secret-service.c index 971c940..9b82f3b 100644 --- a/library/secret-service.c +++ b/library/secret-service.c @@ -403,8 +403,10 @@ secret_service_signal (GDBusProxy *proxy, g_mutex_unlock (&self->pv->mutex); - secret_collection_refresh (collection); - g_object_unref (collection); + if (collection) { + secret_collection_refresh (collection); + g_object_unref (collection); + } } g_variant_unref (paths);