summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hcid/dbus-service.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/hcid/dbus-service.c b/hcid/dbus-service.c
index 53134a2c..dc1f7552 100644
--- a/hcid/dbus-service.c
+++ b/hcid/dbus-service.c
@@ -337,7 +337,14 @@ static DBusHandlerResult start(DBusConnection *conn,
DBusPendingCall *pending;
struct service_call *call_data;
struct service_agent *agent = data;
- DBusMessage *forward = dbus_message_copy(msg);
+ DBusMessage *forward;
+
+ if (agent->running)
+ return error_failed(conn, msg, EPERM);
+
+ forward = dbus_message_copy(msg);
+ if (!forward)
+ return DBUS_HANDLER_RESULT_NEED_MEMORY;
dbus_message_set_destination(forward, agent->id);
dbus_message_set_interface(forward, "org.bluez.ServiceAgent");