mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-16 08:44:38 +08:00
Fix memory leaks with HAL messages
This commit is contained in:
parent
dbe884207a
commit
9009725785
@ -50,6 +50,7 @@ static void formfactor_reply(DBusPendingCall *call, void *user_data)
|
|||||||
if (dbus_message_get_args(reply, NULL, DBUS_TYPE_STRING, &formfactor,
|
if (dbus_message_get_args(reply, NULL, DBUS_TYPE_STRING, &formfactor,
|
||||||
DBUS_TYPE_INVALID) == FALSE) {
|
DBUS_TYPE_INVALID) == FALSE) {
|
||||||
error("Wrong formfactor arguments");
|
error("Wrong formfactor arguments");
|
||||||
|
dbus_message_unref(reply);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,6 +67,8 @@ static void formfactor_reply(DBusPendingCall *call, void *user_data)
|
|||||||
minor += 1 << 4;
|
minor += 1 << 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dbus_message_unref(reply);
|
||||||
|
|
||||||
dd = hci_open_dev(adapter_get_dev_id(adapter));
|
dd = hci_open_dev(adapter_get_dev_id(adapter));
|
||||||
if (dd < 0)
|
if (dd < 0)
|
||||||
return;
|
return;
|
||||||
@ -114,12 +117,15 @@ static int hal_probe(struct btd_adapter *adapter)
|
|||||||
if (dbus_connection_send_with_reply(connection, message,
|
if (dbus_connection_send_with_reply(connection, message,
|
||||||
&call, -1) == FALSE) {
|
&call, -1) == FALSE) {
|
||||||
error("Failed to send formfactor request");
|
error("Failed to send formfactor request");
|
||||||
|
dbus_message_unref(message);
|
||||||
dbus_connection_unref(connection);
|
dbus_connection_unref(connection);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
dbus_pending_call_set_notify(call, formfactor_reply, adapter, NULL);
|
dbus_pending_call_set_notify(call, formfactor_reply, adapter, NULL);
|
||||||
|
|
||||||
|
dbus_message_unref(message);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user