[gnome-control-center] network: Avoid run-time warnings
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] network: Avoid run-time warnings
- Date: Thu, 18 Nov 2010 03:05:11 +0000 (UTC)
commit 9b1176aefc85cdf1c55473b85f2a01284e2803d7
Author: Bastien Nocera <hadess hadess net>
Date: Thu Nov 18 03:02:49 2010 +0000
network: Avoid run-time warnings
As the GPtrArray for the ignored_hosts is never actually created,
and a use-after-free as we didn't dup the strings into the array,
and freed the array.
panels/network/gnome-network-properties.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/panels/network/gnome-network-properties.c b/panels/network/gnome-network-properties.c
index 1f2398f..d8275ac 100644
--- a/panels/network/gnome-network-properties.c
+++ b/panels/network/gnome-network-properties.c
@@ -1120,7 +1120,9 @@ proxy_settings_changed_cb (GSettings *settings,
gchar **hosts;
guint i = 0;
- g_ptr_array_free (ignore_hosts, TRUE);
+ if (ignore_hosts != NULL)
+ g_ptr_array_free (ignore_hosts, TRUE);
+ ignore_hosts = g_ptr_array_new_with_free_func ((GDestroyNotify) g_free);
hosts = g_settings_get_strv (proxy_settings, "ignore-hosts");
while (hosts[i] != NULL) {
@@ -1129,7 +1131,9 @@ proxy_settings_changed_cb (GSettings *settings,
}
populate_listmodel (GTK_LIST_STORE (model), ignore_hosts);
- g_strfreev (hosts);
+ /* Note: not g_strfreev() so we don't have to dup the strings
+ * we put in the array in the loop above */
+ g_free (hosts);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]