diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2005-10-13 09:33:13 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2005-10-13 09:33:13 +0000 |
commit | caab20b1789e6f38531897dad0c72833c67bf960 (patch) | |
tree | 393288c103e6748d0c4f1ac9a7fae8bcc126441e | |
parent | af1ee190718a073e2b291151903478cf82f5bf14 (diff) |
Fix a segmentation fault for hci_dbus_data allocation
-rw-r--r-- | hcid/dbus.c | 8 |
1 files changed, 7 insertions, 1 deletions
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 */ } |