dbus: Do not deinitialize new D-Bus API if it is not initialized

This fixes a crash on error path when D-Bus initialization fails.
This commit is contained in:
Jouni Malinen 2009-12-31 21:50:12 +02:00
parent 8ddef94bd4
commit 26e054ce6b
2 changed files with 5 additions and 0 deletions

View file

@ -24,6 +24,7 @@ struct wpas_dbus_priv {
int should_dispatch;
struct wpa_global *global;
u32 next_objid;
int dbus_new_initialized;
};
#endif /* DBUS_COMMON_I_H */

View file

@ -1070,6 +1070,8 @@ int wpas_dbus_ctrl_iface_init(struct wpas_dbus_priv *priv)
obj_desc);
if (ret < 0)
free_dbus_object_desc(obj_desc);
else
priv->dbus_new_initialized = 1;
return ret;
}
@ -1085,6 +1087,8 @@ int wpas_dbus_ctrl_iface_init(struct wpas_dbus_priv *priv)
*/
void wpas_dbus_ctrl_iface_deinit(struct wpas_dbus_priv *iface)
{
if (!iface->dbus_new_initialized)
return;
wpa_printf(MSG_DEBUG, "dbus: Unregister D-Bus object '%s'",
WPAS_DBUS_NEW_PATH);
dbus_connection_unregister_object_path(iface->con,