2008-10-20 Dan Williams <dcbw@redhat.com>
authorDan Williams <dcbw@redhat.com>
Mon, 20 Oct 2008 11:52:11 +0000 (11:52 +0000)
committerDan Williams <dcbw@redhat.com>
Mon, 20 Oct 2008 11:52:11 +0000 (11:52 +0000)
* 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

git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4196 4912f4e0-d625-0410-9fb7-b9a5a253dbdc

ChangeLog
src/dhcp-manager/nm-dhcp-manager.c

index 06b38ec..40bd0ae 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+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
+
 2008-10-20  Dan Williams  <dcbw@redhat.com>
 
        * src/nm-manager.c
index a2e8233..d052fe8 100644 (file)
@@ -77,8 +77,10 @@ nm_dhcp_manager_get (void)
 
        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 @@ nm_dhcp_device_destroy (NMDHCPDevice *device)
        g_free (device->pid_file);
        g_free (device->lease_file);
        g_free (device->iface);
+
        g_slice_free (NMDHCPDevice, device);
 }
 
@@ -667,18 +670,21 @@ nm_dhcp_manager_cancel_transaction_real (NMDHCPDevice *device)
        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);