summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2009-12-31 20:07:41 -0800
committerMarcel Holtmann <marcel@holtmann.org>2009-12-31 20:07:41 -0800
commitfb2a03c1b128e6c79103ebc098fa394b7c2bf4c3 (patch)
tree543b30abb89b73dba4eef57017d25e34af2f62b6 /plugins
parent3150ca3c9379ebf811d26dace9153f19a0569080 (diff)
downloadconnman-fb2a03c1b128e6c79103ebc098fa394b7c2bf4c3.tar.gz
connman-fb2a03c1b128e6c79103ebc098fa394b7c2bf4c3.tar.bz2
connman-fb2a03c1b128e6c79103ebc098fa394b7c2bf4c3.zip
Fix memory leaks caused by missing dbus_pending_call_unref()
Diffstat (limited to 'plugins')
-rw-r--r--plugins/bluetooth.c22
-rw-r--r--plugins/ofono.c33
-rw-r--r--plugins/supplicant.c37
3 files changed, 49 insertions, 43 deletions
diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
index da150f2e..0f0abb7c 100644
--- a/plugins/bluetooth.c
+++ b/plugins/bluetooth.c
@@ -86,8 +86,6 @@ static void connect_reply(DBusPendingCall *call, void *user_data)
DBG("network %p", network);
reply = dbus_pending_call_steal_reply(call);
- if (reply == NULL)
- return;
dbus_error_init(&error);
@@ -117,6 +115,8 @@ static void connect_reply(DBusPendingCall *call, void *user_data)
done:
dbus_message_unref(reply);
+
+ dbus_pending_call_unref(call);
}
static int pan_connect(struct connman_network *network)
@@ -173,8 +173,6 @@ static void disconnect_reply(DBusPendingCall *call, void *user_data)
DBG("network %p", network);
reply = dbus_pending_call_steal_reply(call);
- if (reply == NULL)
- return;
dbus_error_init(&error);
@@ -192,6 +190,8 @@ static void disconnect_reply(DBusPendingCall *call, void *user_data)
done:
dbus_message_unref(reply);
+
+ dbus_pending_call_unref(call);
}
static int pan_disconnect(struct connman_network *network)
@@ -267,6 +267,8 @@ static void powered_reply(DBusPendingCall *call, void *user_data)
reply = dbus_pending_call_steal_reply(call);
dbus_message_unref(reply);
+
+ dbus_pending_call_unref(call);
}
static int change_powered(DBusConnection *connection, const char *path,
@@ -433,8 +435,6 @@ static void network_properties_reply(DBusPendingCall *call, void *user_data)
char ident[13];
reply = dbus_pending_call_steal_reply(call);
- if (reply == NULL)
- return;
extract_properties(reply, &parent, &address, NULL, &name,
NULL, NULL, &uuids, NULL);
@@ -483,6 +483,8 @@ static void network_properties_reply(DBusPendingCall *call, void *user_data)
done:
dbus_message_unref(reply);
+
+ dbus_pending_call_unref(call);
}
static void add_network(struct connman_device *device, const char *path)
@@ -591,8 +593,6 @@ static void adapter_properties_reply(DBusPendingCall *call, void *user_data)
DBG("path %s", path);
reply = dbus_pending_call_steal_reply(call);
- if (reply == NULL)
- return;
if (path == NULL)
goto done;
@@ -645,6 +645,8 @@ update:
done:
dbus_message_unref(reply);
+
+ dbus_pending_call_unref(call);
}
static void add_adapter(DBusConnection *connection, const char *path)
@@ -718,8 +720,6 @@ static void list_adapters_reply(DBusPendingCall *call, void *user_data)
DBG("");
reply = dbus_pending_call_steal_reply(call);
- if (reply == NULL)
- return;
dbus_error_init(&error);
@@ -742,6 +742,8 @@ static void list_adapters_reply(DBusPendingCall *call, void *user_data)
done:
dbus_message_unref(reply);
+
+ dbus_pending_call_unref(call);
}
static void unregister_device(gpointer data)
diff --git a/plugins/ofono.c b/plugins/ofono.c
index 3cbfb71b..e1bacbd3 100644
--- a/plugins/ofono.c
+++ b/plugins/ofono.c
@@ -90,6 +90,8 @@ static void powered_reply(DBusPendingCall *call, void *user_data)
}
dbus_message_unref(reply);
+
+ dbus_pending_call_unref(call);
}
static int gprs_change_powered(const char *path, dbus_bool_t powered)
@@ -188,8 +190,6 @@ static void config_network_reply(DBusPendingCall *call, void *user_data)
DBG("network %p", network);
reply = dbus_pending_call_steal_reply(call);
- if (reply == NULL)
- goto done;
if (dbus_message_iter_init(reply, &array) == FALSE)
goto done;
@@ -249,6 +249,8 @@ static void config_network_reply(DBusPendingCall *call, void *user_data)
done:
dbus_message_unref(reply);
+
+ dbus_pending_call_unref(call);
}
static void config_network(struct connman_network *network, const char *path)
@@ -336,12 +338,10 @@ static void set_active_reply(DBusPendingCall *call, void *user_data)
DBG("network %p", network);
- if (pending_network_is_available(network) == FALSE)
- return;
-
reply = dbus_pending_call_steal_reply(call);
- if (reply == NULL)
- return;
+
+ if (pending_network_is_available(network) == FALSE)
+ goto done;
dbus_error_init(&error);
if (dbus_set_error_from_message(&error, reply)) {
@@ -357,7 +357,10 @@ static void set_active_reply(DBusPendingCall *call, void *user_data)
} else
pending_network = network;
+done:
dbus_message_unref(reply);
+
+ dbus_pending_call_unref(call);
}
static int set_network_active(struct connman_network *network,
@@ -496,8 +499,6 @@ static void check_networks_reply(DBusPendingCall *call, void *user_data)
DBG("device %p", device);
reply = dbus_pending_call_steal_reply(call);
- if (reply == NULL)
- goto done;
if (dbus_message_iter_init(reply, &array) == FALSE)
goto done;
@@ -545,6 +546,8 @@ static void check_networks_reply(DBusPendingCall *call, void *user_data)
done:
dbus_message_unref(reply);
+
+ dbus_pending_call_unref(call);
}
static void check_networks(struct modem_data *modem)
@@ -633,8 +636,6 @@ static void sim_properties_reply(DBusPendingCall *call, void *user_data)
DBG("path %s", path);
reply = dbus_pending_call_steal_reply(call);
- if (reply == NULL)
- return;
if (dbus_message_iter_init(reply, &array) == FALSE)
goto done;
@@ -665,6 +666,8 @@ static void sim_properties_reply(DBusPendingCall *call, void *user_data)
done:
dbus_message_unref(reply);
+
+ dbus_pending_call_unref(call);
}
static void get_imsi(const char *path)
@@ -797,8 +800,6 @@ static void modem_properties_reply(DBusPendingCall *call, void *user_data)
DBG("path %s", path);
reply = dbus_pending_call_steal_reply(call);
- if (reply == NULL)
- goto done;
if (dbus_message_iter_init(reply, &array) == FALSE)
goto done;
@@ -836,6 +837,8 @@ static void modem_properties_reply(DBusPendingCall *call, void *user_data)
done:
dbus_message_unref(reply);
+
+ dbus_pending_call_unref(call);
}
static void get_modem_properties(struct modem_data *modem)
@@ -931,8 +934,6 @@ static void manager_properties_reply(DBusPendingCall *call, void *user_data)
DBG("");
reply = dbus_pending_call_steal_reply(call);
- if (reply == NULL)
- goto done;
if (dbus_message_iter_init(reply, &array) == FALSE)
goto done;
@@ -962,6 +963,8 @@ static void manager_properties_reply(DBusPendingCall *call, void *user_data)
done:
dbus_message_unref(reply);
+
+ dbus_pending_call_unref(call);
}
static void modem_remove_device(struct modem_data *modem)
diff --git a/plugins/supplicant.c b/plugins/supplicant.c
index a9c524c2..6d026bcc 100644
--- a/plugins/supplicant.c
+++ b/plugins/supplicant.c
@@ -313,8 +313,6 @@ static void add_interface_reply(DBusPendingCall *call, void *user_data)
DBG("task %p", task);
reply = dbus_pending_call_steal_reply(call);
- if (reply == NULL)
- return;
if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR)
goto failed;
@@ -340,11 +338,15 @@ static void add_interface_reply(DBusPendingCall *call, void *user_data)
dbus_message_unref(reply);
+ dbus_pending_call_unref(call);
+
return;
failed:
dbus_message_unref(reply);
+ dbus_pending_call_unref(call);
+
task_list = g_slist_remove(task_list, task);
connman_device_unref(task->device);
@@ -410,8 +412,6 @@ static void get_interface_reply(DBusPendingCall *call, void *user_data)
DBG("task %p", task);
reply = dbus_pending_call_steal_reply(call);
- if (reply == NULL)
- return;
if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR) {
add_interface(task);
@@ -439,6 +439,8 @@ static void get_interface_reply(DBusPendingCall *call, void *user_data)
done:
dbus_message_unref(reply);
+
+ dbus_pending_call_unref(call);
}
static int create_interface(struct supplicant_task *task)
@@ -496,6 +498,8 @@ static void remove_interface_reply(DBusPendingCall *call, void *user_data)
free_task(task);
dbus_message_unref(reply);
+
+ dbus_pending_call_unref(call);
}
static int remove_interface(struct supplicant_task *task)
@@ -1062,8 +1066,6 @@ static void scan_reply(DBusPendingCall *call, void *user_data)
task->scan_call = NULL;
reply = dbus_pending_call_steal_reply(call);
- if (reply == NULL)
- return;
if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR) {
connman_device_set_scanning(task->device, FALSE);
@@ -1075,6 +1077,8 @@ static void scan_reply(DBusPendingCall *call, void *user_data)
done:
dbus_message_unref(reply);
+
+ dbus_pending_call_unref(call);
}
@@ -1427,16 +1431,9 @@ static void properties_reply(DBusPendingCall *call, void *user_data)
DBG("task %p", task);
reply = dbus_pending_call_steal_reply(call);
- if (reply == NULL) {
- get_properties(task);
- return;
- }
- if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR) {
- dbus_message_unref(reply);
- get_properties(task);
- return;
- }
+ if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR)
+ goto unref;
memset(&result, 0, sizeof(result));
result.frequency = -1;
@@ -1600,8 +1597,11 @@ done:
g_free(result.name);
g_free(result.ssid);
+unref:
dbus_message_unref(reply);
+ dbus_pending_call_unref(call);
+
get_properties(task);
}
@@ -1666,8 +1666,6 @@ static void scan_results_reply(DBusPendingCall *call, void *user_data)
DBG("task %p", task);
reply = dbus_pending_call_steal_reply(call);
- if (reply == NULL)
- goto noscan;
if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR)
goto done;
@@ -1701,6 +1699,8 @@ static void scan_results_reply(DBusPendingCall *call, void *user_data)
dbus_message_unref(reply);
+ dbus_pending_call_unref(call);
+
get_properties(task);
return;
@@ -1708,7 +1708,8 @@ static void scan_results_reply(DBusPendingCall *call, void *user_data)
done:
dbus_message_unref(reply);
-noscan:
+ dbus_pending_call_unref(call);
+
task->result_call = NULL;
if (task->scanning == TRUE) {