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.
This commit is contained in:
parent
3b8ae693d5
commit
9b1176aefc
1 changed files with 6 additions and 2 deletions
|
@ -1120,7 +1120,9 @@ proxy_settings_changed_cb (GSettings *settings,
|
||||||
gchar **hosts;
|
gchar **hosts;
|
||||||
guint i = 0;
|
guint i = 0;
|
||||||
|
|
||||||
|
if (ignore_hosts != NULL)
|
||||||
g_ptr_array_free (ignore_hosts, TRUE);
|
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");
|
hosts = g_settings_get_strv (proxy_settings, "ignore-hosts");
|
||||||
while (hosts[i] != NULL) {
|
while (hosts[i] != NULL) {
|
||||||
|
@ -1129,7 +1131,9 @@ proxy_settings_changed_cb (GSettings *settings,
|
||||||
}
|
}
|
||||||
|
|
||||||
populate_listmodel (GTK_LIST_STORE (model), ignore_hosts);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue