From 9009725785ef6e8a7600c5796bdfeedc1586a845 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Tue, 30 Sep 2008 05:01:32 +0200 Subject: Fix memory leaks with HAL messages --- plugins/hal.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'plugins') diff --git a/plugins/hal.c b/plugins/hal.c index 1adab4d8..84b530ee 100644 --- a/plugins/hal.c +++ b/plugins/hal.c @@ -50,6 +50,7 @@ static void formfactor_reply(DBusPendingCall *call, void *user_data) if (dbus_message_get_args(reply, NULL, DBUS_TYPE_STRING, &formfactor, DBUS_TYPE_INVALID) == FALSE) { error("Wrong formfactor arguments"); + dbus_message_unref(reply); return; } @@ -66,6 +67,8 @@ static void formfactor_reply(DBusPendingCall *call, void *user_data) minor += 1 << 4; } + dbus_message_unref(reply); + dd = hci_open_dev(adapter_get_dev_id(adapter)); if (dd < 0) return; @@ -114,12 +117,15 @@ static int hal_probe(struct btd_adapter *adapter) if (dbus_connection_send_with_reply(connection, message, &call, -1) == FALSE) { error("Failed to send formfactor request"); + dbus_message_unref(message); dbus_connection_unref(connection); return -EIO; } dbus_pending_call_set_notify(call, formfactor_reply, adapter, NULL); + dbus_message_unref(message); + return 0; } -- cgit