[Patch] Fix a bunch of leaks
- From: Tambet Ingo <tambet ximian com>
- To: networkmanager-list gnome org
- Subject: [Patch] Fix a bunch of leaks
- Date: Thu, 02 Nov 2006 17:23:08 +0200
Hey,
Just as the subject says, fix about 10 memory leaks.
Tambet
Index: gnome/applet/applet.c
===================================================================
RCS file: /cvs/gnome/NetworkManager/gnome/applet/applet.c,v
retrieving revision 1.112.2.12
diff -u -r1.112.2.12 applet.c
--- gnome/applet/applet.c 25 Oct 2006 03:39:20 -0000 1.112.2.12
+++ gnome/applet/applet.c 2 Nov 2006 15:23:09 -0000
@@ -1764,12 +1764,14 @@
label = g_strdup_printf (_("Connect to %s..."), name);
connect_item = GTK_MENU_ITEM (gtk_menu_item_new_with_label (label));
+ g_free (label);
g_object_set_data (G_OBJECT (connect_item), "dialup", name);
g_signal_connect (G_OBJECT (connect_item), "activate", G_CALLBACK (nma_menu_dialup_connect_item_activate), applet);
gtk_menu_shell_append (GTK_MENU_SHELL (dialup_menu), GTK_WIDGET (connect_item));
label = g_strdup_printf (_("Disconnect from %s..."), name);
disconnect_item = GTK_MENU_ITEM (gtk_menu_item_new_with_label (label));
+ g_free (label);
g_object_set_data (G_OBJECT (disconnect_item), "dialup", name);
g_signal_connect (G_OBJECT (disconnect_item), "activate", G_CALLBACK (nma_menu_dialup_disconnect_item_activate), applet);
gtk_menu_shell_append (GTK_MENU_SHELL (dialup_menu), GTK_WIDGET (disconnect_item));
Index: gnome/applet/menu-items.c
===================================================================
RCS file: /cvs/gnome/NetworkManager/gnome/applet/menu-items.c,v
retrieving revision 1.12.2.1
diff -u -r1.12.2.1 menu-items.c
--- gnome/applet/menu-items.c 17 May 2006 20:03:56 -0000 1.12.2.1
+++ gnome/applet/menu-items.c 2 Nov 2006 15:23:09 -0000
@@ -91,6 +91,7 @@
text = g_strdup (_("_Wired Network"));
gtk_label_set_text_with_mnemonic (GTK_LABEL (item->label), text);
+ g_free (text);
/* Only dim the item if the device supports carrier detection AND
* we know it doesn't have a link.
Index: src/nm-dbus-device.c
===================================================================
RCS file: /cvs/gnome/NetworkManager/src/nm-dbus-device.c,v
retrieving revision 1.27.2.1
diff -u -r1.27.2.1 nm-dbus-device.c
--- src/nm-dbus-device.c 21 Jun 2006 14:33:35 -0000 1.27.2.1
+++ src/nm-dbus-device.c 2 Nov 2006 15:23:09 -0000
@@ -489,6 +489,8 @@
g_free (ip4_address);
g_free (broadcast);
g_free (subnetmask);
+ g_free (primary_dns);
+ g_free (secondary_dns);
}
return reply;
Index: src/nm-device.c
===================================================================
RCS file: /cvs/gnome/NetworkManager/src/nm-device.c,v
retrieving revision 1.17.2.7
diff -u -r1.17.2.7 nm-device.c
--- src/nm-device.c 20 Sep 2006 15:35:12 -0000 1.17.2.7
+++ src/nm-device.c 2 Nov 2006 15:23:10 -0000
@@ -85,14 +85,22 @@
discover_device_type (LibHalContext *ctx, const char *udi)
{
char * category = NULL;
+ NMDeviceType type = DEVICE_TYPE_UNKNOWN;
if (libhal_device_property_exists (ctx, udi, "info.category", NULL))
category = libhal_device_get_property_string(ctx, udi, "info.category", NULL);
- if (category && (!strcmp (category, "net.80211")))
- return DEVICE_TYPE_802_11_WIRELESS;
- else if (category && (!strcmp (category, "net.80203")))
- return DEVICE_TYPE_802_3_ETHERNET;
- return DEVICE_TYPE_UNKNOWN;
+
+ if (category)
+ {
+ if (!strcmp (category, "net.80211"))
+ type = DEVICE_TYPE_802_11_WIRELESS;
+ else if (!strcmp (category, "net.80203"))
+ type = DEVICE_TYPE_802_3_ETHERNET;
+
+ libhal_free_string (category);
+ }
+
+ return type;
}
/*
Index: src/backends/NetworkManagerSuSE.c
===================================================================
RCS file: /cvs/gnome/NetworkManager/src/backends/NetworkManagerSuSE.c,v
retrieving revision 1.32.2.23
diff -u -r1.32.2.23 NetworkManagerSuSE.c
--- src/backends/NetworkManagerSuSE.c 19 Oct 2006 20:39:54 -0000 1.32.2.23
+++ src/backends/NetworkManagerSuSE.c 2 Nov 2006 15:23:10 -0000
@@ -808,6 +808,8 @@
if (sys_data->config)
nm_ip4_config_unref (sys_data->config);
+
+ g_free (sys_data);
}
Index: src/backends/shvar.c
===================================================================
RCS file: /cvs/gnome/NetworkManager/src/backends/shvar.c,v
retrieving revision 1.2
diff -u -r1.2 shvar.c
--- src/backends/shvar.c 6 May 2005 21:20:42 -0000 1.2
+++ src/backends/shvar.c 2 Nov 2006 15:23:10 -0000
@@ -392,7 +392,12 @@
}
g_free(s->fileName);
g_list_free(s->freeList);
- g_list_free(s->lineList); /* implicitly frees s->current */
+
+ if (s->lineList) {
+ g_list_foreach(s->lineList, (GFunc) g_free, NULL);
+ g_list_free(s->lineList); /* implicitly frees s->current */
+ }
+
g_free(s);
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]