Commit 963b72bc authored by Beniamino Galvani's avatar Beniamino Galvani

ifnet: fix memory leaks

Fix memory leaks in ifnet plugin and tests, and re-enable valgrind for
tests.
parent 74a0e74d
......@@ -679,7 +679,7 @@ make_ip4_setting (NMConnection *connection,
/* DNS searches */
value = ifnet_get_data (conn_name, "dns_search");
if (value) {
char *stripped = g_strdup (value);
gs_free char *stripped = g_strdup (value);
char **searches = NULL;
strip_string (stripped, '"');
......
......@@ -501,13 +501,13 @@ GList *
ifnet_get_connection_names (void)
{
GList *names = g_hash_table_get_keys (conn_table);
GList *result = NULL;
GList *iter, *result = NULL;
while (names) {
if (!ignore_connection_name (names->data))
result = g_list_prepend (result, names->data);
names = names->next;
for (iter = names; iter; iter = iter->next) {
if (!ignore_connection_name (iter->data))
result = g_list_prepend (result, iter->data);
}
g_list_free (names);
return g_list_reverse (result);
}
......
......@@ -34,7 +34,7 @@ test_ifnet_LDFLAGS = \
test_ifnet_LDADD = $(top_builddir)/src/libNetworkManager.la
#@VALGRIND_RULES@
@VALGRIND_RULES@
TESTS = test-ifnet
endif
......
......@@ -346,7 +346,7 @@ test_delete_connection (void)
static void
test_missing_config (void)
{
GError *error = NULL;
gs_free_error GError *error = NULL;
NMConnection *connection;
connection = ifnet_update_connection_from_config_block ("eth8", NULL, &error);
......
......@@ -77,9 +77,11 @@ add_security (GHashTable *security)
/* Hex format begins with " */
is_hex_ssid = (ssid[0] != '"');
if ((value = g_hash_table_lookup (security, "disabled")) != NULL) {
if (strcmp (value, "1") == 0)
if (strcmp (value, "1") == 0) {
destroy_security (security);
return NULL;
}
}
/* Default priority is 1 */
if (g_hash_table_lookup (security, "priority") == NULL)
......@@ -111,6 +113,7 @@ add_security (GHashTable *security)
static void
add_key_value (GHashTable * network, gchar * line)
{
gpointer orig_key, orig_value;
gchar **key_value;
if (g_str_has_prefix (line, "network={"))
......@@ -133,6 +136,14 @@ add_key_value (GHashTable * network, gchar * line)
&& !g_str_has_prefix (key_value[0], "wep_key")
&& strcmp (key_value[0], "ssid") != 0)
strip_string (key_value[1], '"');
/* This sucks */
if (g_hash_table_lookup_extended (network, key_value[0], &orig_key, &orig_value)) {
g_hash_table_remove (network, orig_key);
g_free (orig_key);
g_free (orig_value);
}
g_hash_table_insert (network, g_strdup (key_value[0]),
g_strdup (key_value[1]));
g_strfreev (key_value);
......
......@@ -440,3 +440,11 @@
fun:start_thread
fun:clone
}
{
_btrfs_io_clone
Memcheck:Param
ioctl(generic)
fun:ioctl
fun:btrfs_reflink_with_progress
...
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment