summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaurav Babu <saurav.babu@samsung.com>2015-12-15 09:12:02 +0530
committerSaurav Babu <saurav.babu@samsung.com>2015-12-15 09:12:02 +0530
commit6bcba613d63d3ecc7d70c1e0a67b64e427a6e62b (patch)
tree8775bf2dac0ce9de6c97ebf60e87974fd8e78e47
parentf4b6dfbed5104504344038b3b522391ac8d19d81 (diff)
downloadconnman-6bcba613d63d3ecc7d70c1e0a67b64e427a6e62b.tar.gz
connman-6bcba613d63d3ecc7d70c1e0a67b64e427a6e62b.tar.bz2
connman-6bcba613d63d3ecc7d70c1e0a67b64e427a6e62b.zip
Fixed various memory leak issues
Change-Id: I7de6bb13d8b17582d705e6e67ec1dc4cb7cb9713 Signed-off-by: Saurav Babu <saurav.babu@samsung.com>
-rwxr-xr-xgdbus/watch.c50
-rwxr-xr-xsrc/dhcp.c3
-rwxr-xr-xsrc/service.c2
3 files changed, 29 insertions, 26 deletions
diff --git a/gdbus/watch.c b/gdbus/watch.c
index b60f650f..447e4867 100755
--- a/gdbus/watch.c
+++ b/gdbus/watch.c
@@ -204,6 +204,30 @@ static gboolean remove_match(struct filter_data *data)
return TRUE;
}
+static void filter_data_free(struct filter_data *data)
+{
+ GSList *l;
+
+ /* Remove filter if there are no listeners left for the connection */
+ if (filter_data_find(data->connection) == NULL)
+ dbus_connection_remove_filter(data->connection, message_filter,
+ NULL);
+
+ for (l = data->callbacks; l != NULL; l = l->next)
+ g_free(l->data);
+
+ g_slist_free(data->callbacks);
+ g_dbus_remove_watch(data->connection, data->name_watch);
+ g_free(data->name);
+ g_free(data->owner);
+ g_free(data->path);
+ g_free(data->interface);
+ g_free(data->member);
+ g_free(data->argument);
+ dbus_connection_unref(data->connection);
+ g_free(data);
+}
+
static struct filter_data *filter_data_get(DBusConnection *connection,
DBusHandleMessageFunction filter,
const char *sender,
@@ -248,7 +272,7 @@ proceed:
data->argument = g_strdup(argument);
if (!add_match(data, filter)) {
- g_free(data);
+ filter_data_free(data);
return NULL;
}
@@ -277,30 +301,6 @@ static struct filter_callback *filter_data_find_callback(
return NULL;
}
-static void filter_data_free(struct filter_data *data)
-{
- GSList *l;
-
- /* Remove filter if there are no listeners left for the connection */
- if (filter_data_find(data->connection) == NULL)
- dbus_connection_remove_filter(data->connection, message_filter,
- NULL);
-
- for (l = data->callbacks; l != NULL; l = l->next)
- g_free(l->data);
-
- g_slist_free(data->callbacks);
- g_dbus_remove_watch(data->connection, data->name_watch);
- g_free(data->name);
- g_free(data->owner);
- g_free(data->path);
- g_free(data->interface);
- g_free(data->member);
- g_free(data->argument);
- dbus_connection_unref(data->connection);
- g_free(data);
-}
-
static void filter_data_call_and_free(struct filter_data *data)
{
GSList *l;
diff --git a/src/dhcp.c b/src/dhcp.c
index 9a743626..e4497fcc 100755
--- a/src/dhcp.c
+++ b/src/dhcp.c
@@ -462,11 +462,12 @@ static void lease_available_cb(GDHCPClient *dhcp_client, gpointer user_data)
}
if (!apply_lease_available_on_network(dhcp_client, dhcp))
- return;
+ goto done;
if (ip_change)
dhcp_valid(dhcp);
+done:
g_free(address);
g_free(netmask);
g_free(gateway);
diff --git a/src/service.c b/src/service.c
index adbb1bce..daf1a47f 100755
--- a/src/service.c
+++ b/src/service.c
@@ -680,6 +680,8 @@ static int service_load(struct connman_service *service)
connman_network_set_blob(service->network,
"WiFi.SSID", ssid, hex_ssid_len / 2);
+
+ g_free(ssid);
}
g_free(hex_ssid);