ofono: Duplicate network path value
authorYu A Wang <yu.a.wang@intel.com>
Sat, 30 Jul 2011 03:02:42 +0000 (23:02 -0400)
committerSamuel Ortiz <sameo@linux.intel.com>
Thu, 4 Aug 2011 14:30:44 +0000 (16:30 +0200)
Path value will be freed after the function call, this may lead to
can't connect/reconnect to a 3G service

plugins/ofono.c

index 8650bfc..ea4692f 100644 (file)
@@ -882,7 +882,7 @@ static int add_network(struct connman_device *device,
 
        create_service(network);
 
-       g_hash_table_insert(network_hash, (char *) path, info);
+       g_hash_table_insert(network_hash, g_strdup(path), info);
 
        connman_network_set_available(network, TRUE);
        connman_network_set_index(network, -1);
@@ -1585,7 +1585,7 @@ static void ofono_connect(DBusConnection *connection, void *user_data)
                                                g_free, remove_modem);
 
        network_hash = g_hash_table_new_full(g_str_hash, g_str_equal,
-                                               NULL, remove_network);
+                                               g_free, remove_network);
 
        call_ofono("/", OFONO_MANAGER_INTERFACE, GET_MODEMS,
                        manager_modems_reply, NULL, NULL,