[PATCH] settings: don't dereference NULL pointer on request removing.



Hello!

Function request_free() (nm-agent-manager.c) is registered as a
function for freeing the value for the hash table 'requests'.
But if request was created by request_new_other() then fields
'cancel_callback' and 'authority' were not setted.

-- 
WBR, Mikhail Efremov
>From dca07cb8a4820e9aaad4aaf8d0b78ba7ce92510d Mon Sep 17 00:00:00 2001
From: Mikhail Efremov <sem altlinux org>
Date: Mon, 28 Feb 2011 19:04:55 +0300
Subject: [PATCH] settings: don't dereference NULL pointer on request removing.

---
 src/settings/nm-agent-manager.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/settings/nm-agent-manager.c b/src/settings/nm-agent-manager.c
index 0ffcfd4..54b7d53 100644
--- a/src/settings/nm-agent-manager.c
+++ b/src/settings/nm-agent-manager.c
@@ -448,7 +448,8 @@ request_free (Request *req)
 	if (req->idle_id)
 		g_source_remove (req->idle_id);
 
-	req->cancel_callback (req);
+	if (req->cancel_callback)
+		req->cancel_callback (req);
 
 	g_slist_free (req->pending);
 	g_slist_free (req->asked);
@@ -459,7 +460,8 @@ request_free (Request *req)
 		g_hash_table_unref (req->existing_secrets);
 	if (req->chain)
 		nm_auth_chain_unref (req->chain);
-	g_object_unref (req->authority);
+	if (req->authority)
+		g_object_unref (req->authority);
 	memset (req, 0, sizeof (Request));
 	g_free (req);
 }
-- 
1.7.4.1



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]