File PolicyKit-0.9-NULLwarning.diff of Package PolicyKit

From 213a0239a31f28c9d4341e1bcd400268de6047fb Mon Sep 17 00:00:00 2001
From: Ludwig Nussel <ludwig.nussel@suse.de>
Date: Mon, 11 Oct 2010 08:50:17 +0200
Subject: [PATCH] avoid warning due to calling *_unref on NULL (bnc#644966)

---
 src/polkit/polkit-context.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/polkit/polkit-context.c b/src/polkit/polkit-context.c
index 62f246d..db790c6 100644
--- a/src/polkit/polkit-context.c
+++ b/src/polkit/polkit-context.c
@@ -465,8 +465,12 @@ polkit_context_unref (PolKitContext *pk_context)
                 return;
 
         polkit_authorization_db_unref (pk_context->authdb);
-        polkit_config_unref (pk_context->config);
-        polkit_policy_cache_unref (pk_context->priv_cache);
+        if (pk_context->config != NULL) {
+		polkit_config_unref (pk_context->config);
+	}
+        if (pk_context->priv_cache != NULL) {
+		polkit_policy_cache_unref (pk_context->priv_cache);
+	}
         kit_free (pk_context->policy_dir);
         kit_free (pk_context);
 }
-- 
1.7.1

openSUSE Build Service is sponsored by