diff options
author | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2007-06-21 21:52:51 +0000 |
---|---|---|
committer | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2007-06-21 21:52:51 +0000 |
commit | 5fcad6abebf97c6a06d9eb5c206d5c10bcf14eb7 (patch) | |
tree | 50bd7e336f03ca6fcf721905146b9cbfbcb0d40a /common/dbus-helper.c | |
parent | 3a653f915b0e7de28e111665ba40b69ae6d6a235 (diff) |
dbus-helper: avoid seg fault when the object path data is not available(unregistered)
Diffstat (limited to 'common/dbus-helper.c')
-rw-r--r-- | common/dbus-helper.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/common/dbus-helper.c b/common/dbus-helper.c index e80d49cd..488b1d2f 100644 --- a/common/dbus-helper.c +++ b/common/dbus-helper.c @@ -285,7 +285,7 @@ static DBusObjectPathVTable generic_table = { static void update_parent_data(DBusConnection *conn, const char *child_path) { - struct generic_data *data; + struct generic_data *data = NULL; char *parent_path, *slash; parent_path = g_strdup(child_path); @@ -350,10 +350,10 @@ dbus_bool_t dbus_connection_get_object_user_data(DBusConnection *connection, const char *path, void **data_p) { - struct generic_data *data; + struct generic_data *data = NULL; if (!dbus_connection_get_object_path_data(connection, path, - (void *) &data)) + (void *) &data) || !data) return FALSE; *data_p = data->user_data; @@ -367,11 +367,11 @@ dbus_bool_t dbus_connection_register_interface(DBusConnection *connection, DBusSignalVTable *signals, DBusPropertyVTable *properties) { - struct generic_data *data; + struct generic_data *data = NULL; struct interface_data *iface; if (!dbus_connection_get_object_path_data(connection, path, - (void *) &data)) + (void *) &data) || !data) return FALSE; if (find_interface(data->interfaces, name)) @@ -395,11 +395,11 @@ dbus_bool_t dbus_connection_register_interface(DBusConnection *connection, dbus_bool_t dbus_connection_unregister_interface(DBusConnection *connection, const char *path, const char *name) { - struct generic_data *data; + struct generic_data *data = NULL; struct interface_data *iface; if (!dbus_connection_get_object_path_data(connection, path, - (void *) &data)) + (void *) &data) || !data) return FALSE; iface = find_interface(data->interfaces, name); @@ -462,14 +462,15 @@ dbus_bool_t dbus_connection_emit_signal_valist(DBusConnection *conn, int first, va_list var_args) { - struct generic_data *data; + struct generic_data *data = NULL; struct interface_data *iface; DBusSignalVTable *sig_data; DBusMessage *signal; dbus_bool_t ret; const char *signature, *args = NULL; - if (!dbus_connection_get_object_path_data(conn, path, (void *) &data)) { + if (!dbus_connection_get_object_path_data(conn, path, + (void *) &data) || !data) { error("dbus_connection_emit_signal: path %s isn't registered", path); return FALSE; |