From: Niraj Kumar Goit Date: Wed, 20 Jan 2016 11:39:34 +0000 (+0530) Subject: [net-config] Pointer is passed to g_free() after the memory was deallocated X-Git-Tag: submit/tizen/20160211.015108~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=628ce0b7cd53c7b8f5c45cb44ee2a585e325ff8c;p=platform%2Fcore%2Fconnectivity%2Fnet-config.git [net-config] Pointer is passed to g_free() after the memory was deallocated In handle_set_field() function, pointer is passed to a g_free() after the referenced memory was deallocated. Members of structure netconfig_wifi_agent was cleared and reinitialized in __netconfig_agent_clear_fields. Change-Id: I5d506c10e51507383ae4d331cd88a967d64dd259 Signed-off-by: Niraj Kumar Goit --- diff --git a/packaging/net-config.spec b/packaging/net-config.spec index 56f635c..eb59aa9 100755 --- a/packaging/net-config.spec +++ b/packaging/net-config.spec @@ -1,6 +1,6 @@ Name: net-config Summary: TIZEN Network Configuration service -Version: 1.1.50 +Version: 1.1.51 Release: 2 Group: System/Network License: Apache-2.0 diff --git a/src/wifi-agent.c b/src/wifi-agent.c index c4456c7..b8b02a6 100755 --- a/src/wifi-agent.c +++ b/src/wifi-agent.c @@ -203,17 +203,13 @@ gboolean handle_set_field(NetConnmanAgent *connman_agent, g_variant_get(fields, "a{sv}", &iter); while (g_variant_iter_loop(iter, "{sv}", &field, &value)) { if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_PASSPHRASE) == 0) { - g_free(agent.passphrase); if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) { agent.passphrase = g_strdup(g_variant_get_string(value, NULL)); updated = TRUE; DBG("Field [%s] - []", field); - } else { - agent.passphrase = NULL; } } else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_WPS_PBC) == 0) { - agent.wps_pbc = FALSE; if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING) && g_strcmp0(g_variant_get_string(value, NULL), "enable") == 0) { agent.wps_pbc = TRUE; @@ -222,25 +218,18 @@ gboolean handle_set_field(NetConnmanAgent *connman_agent, DBG("Field [%s] - [%d]", field, agent.wps_pbc); } } else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_WPS_PIN) == 0) { - g_free(agent.wps_pin); - agent.wps_pbc = FALSE; if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) { agent.wps_pin = g_strdup(g_variant_get_string(value, NULL)); updated = TRUE; DBG("Field [%s] - []", field); - } else { - agent.wps_pin = NULL; } } else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_NAME) == 0) { - g_free(agent.name); if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) { agent.name = g_strdup(g_variant_get_string(value, NULL)); updated = TRUE; DBG("Field [%s] - []", field); - } else { - agent.name = NULL; } } else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_SSID) == 0) { if (agent.ssid != NULL) { @@ -268,14 +257,11 @@ gboolean handle_set_field(NetConnmanAgent *connman_agent, } } } else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_IDENTITY) == 0) { - g_free(agent.identity); if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) { agent.identity = g_strdup(g_variant_get_string(value, NULL)); updated = TRUE; DBG("Field [%s] - []", field); - } else { - agent.identity = NULL; } } }