summaryrefslogtreecommitdiffstats
path: root/hcid/dbus-security.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2007-03-12 19:05:24 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2007-03-12 19:05:24 +0000
commitd58cc6f8e0739585228fb9e4cb95d947354bb74c (patch)
tree072c5d01aea280611b552f3716411d1a2c8feead /hcid/dbus-security.c
parent29b4c4f802c7e9cfc40d70721f77caf25c409821 (diff)
Fix segfault when no passkey agents are registered
Diffstat (limited to 'hcid/dbus-security.c')
-rw-r--r--hcid/dbus-security.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/hcid/dbus-security.c b/hcid/dbus-security.c
index 263517e1..1d034c2e 100644
--- a/hcid/dbus-security.c
+++ b/hcid/dbus-security.c
@@ -1022,11 +1022,11 @@ static int call_passkey_agent(DBusConnection *conn,
const char *path, bdaddr_t *sba,
bdaddr_t *dba)
{
- struct pending_agent_request *req = NULL;
+ struct pending_agent_request *req;
if (!agent) {
debug("call_passkey_agent(): no agent available");
- goto failed;
+ goto send;
}
debug("Calling PasskeyAgent.Request: name=%s, path=%s",
@@ -1053,6 +1053,7 @@ failed:
g_free(req->path);
g_free(req);
+send:
hci_send_cmd(dev, OGF_LINK_CTL, OCF_PIN_CODE_NEG_REPLY, 6, dba);
return -1;
@@ -1198,11 +1199,11 @@ static int call_confirm_agent(DBusConnection *conn,
const char *path, bdaddr_t *sba,
bdaddr_t *dba, const char *pin)
{
- struct pending_agent_request *req = NULL;
+ struct pending_agent_request *req;
if (!agent) {
debug("call_passkey_agent(): no agent available");
- goto failed;
+ goto send;
}
debug("Calling PasskeyAgent.Confirm: name=%s, path=%s",
@@ -1227,12 +1228,11 @@ static int call_confirm_agent(DBusConnection *conn,
return 0;
failed:
- if (req) {
- g_free(req->pin);
- g_free(req->path);
- g_free(req);
- }
+ g_free(req->pin);
+ g_free(req->path);
+ g_free(req);
+send:
hci_send_cmd(dev, OGF_LINK_CTL, OCF_PIN_CODE_NEG_REPLY, 6, dba);
return -1;