From caab20b1789e6f38531897dad0c72833c67bf960 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Thu, 13 Oct 2005 09:33:13 +0000 Subject: Fix a segmentation fault for hci_dbus_data allocation --- hcid/dbus.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hcid/dbus.c b/hcid/dbus.c index 50e95318..9f06f928 100644 --- a/hcid/dbus.c +++ b/hcid/dbus.c @@ -774,7 +774,13 @@ static int hci_dbus_reg_obj_path(DBusConnection *conn, int dft_reg, uint16_t id) syslog(LOG_INFO, "registering dft path:%s - id:%d", path, DEFAULT_DEVICE_PATH_ID); - if (!dbus_connection_register_object_path(conn, path, &obj_vtable, (void *) DEFAULT_DEVICE_PATH_ID)) { + data = malloc(sizeof(struct hci_dbus_data)); + if (data == NULL) + return -1; + + data->id = DEFAULT_DEVICE_PATH_ID; + + if (!dbus_connection_register_object_path(conn, path, &obj_vtable, data)) { syslog(LOG_ERR,"DBUS failed to register %s object", path); /* ignore, the default path was already registered */ } -- cgit