NetworkManager r4196 - in trunk: . src/dhcp-manager



Author: dcbw
Date: Mon Oct 20 11:52:11 2008
New Revision: 4196
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=4196&view=rev

Log:
2008-10-20  Dan Williams  <dcbw redhat com>

	* src/dhcp-manager/nm-dhcp-manager.c
		- (nm_dhcp_manager_get): fix mismatched refcount; creating the dhcp
			manager object already refs it once
		- (nm_dhcp_manager_cancel_transaction_real): clear freed variables that
			also get cleaned up by nm_dhcp_device_destroy() to prevent
			double-frees



Modified:
   trunk/ChangeLog
   trunk/src/dhcp-manager/nm-dhcp-manager.c

Modified: trunk/src/dhcp-manager/nm-dhcp-manager.c
==============================================================================
--- trunk/src/dhcp-manager/nm-dhcp-manager.c	(original)
+++ trunk/src/dhcp-manager/nm-dhcp-manager.c	Mon Oct 20 11:52:11 2008
@@ -77,8 +77,10 @@
 
 	if (!singleton)
 		singleton = nm_dhcp_manager_new ();
-	g_object_ref (singleton);
+	else
+		g_object_ref (singleton);
 
+	g_assert (singleton);
 	return singleton;
 }
 
@@ -185,6 +187,7 @@
 	g_free (device->pid_file);
 	g_free (device->lease_file);
 	g_free (device->iface);
+
 	g_slice_free (NMDHCPDevice, device);
 }
 
@@ -667,18 +670,21 @@
 	if (device->pid_file) {
 		remove (device->pid_file);
 		g_free (device->pid_file);
+		device->pid_file = NULL;
 	}
 
 	/* Clean up the leasefile if it got left around */
 	if (device->lease_file) {
 		remove (device->lease_file);
 		g_free (device->lease_file);
+		device->lease_file = NULL;
 	}
 
 	/* Clean up config file if it got left around */
 	if (device->conf_file) {
 		remove (device->conf_file);
 		g_free (device->conf_file);
+		device->conf_file = NULL;
 	}
 
 	nm_dhcp_device_watch_cleanup (device);



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