Free path string first when it is no longer needed

This commit is contained in:
Johan Hedberg 2007-04-20 12:15:20 +00:00
parent 4844b0c1d3
commit f5dcb96ae5

View File

@ -229,7 +229,6 @@ static DBusHandlerResult am_remove_headset(DBusMessage *msg)
path = match->data;
headsets = g_slist_remove(headsets, path);
g_free(path);
if (default_hs == path) {
if (!headsets)
@ -245,6 +244,8 @@ static DBusHandlerResult am_remove_headset(DBusMessage *msg)
headset_remove(path);
g_free(path);
return send_message_and_unref(connection, reply);
}