adhoc: fix bogus Failed error and segfault on stop
The netdev_leave_adhoc() returns a negative errno on errors and zero on success, but adhoc_dbus_stop() assumed the inverse when checking for an error. Also, the DBus message was not being referenced in adhoc->pending and then adhoc_leave_cb() segfaulted attempting to dereference it.
This commit is contained in:
parent
0b65fe3a95
commit
d66dcc9412
|
@ -576,9 +576,11 @@ static struct l_dbus_message *adhoc_dbus_stop(struct l_dbus *dbus,
|
||||||
if (!adhoc->started)
|
if (!adhoc->started)
|
||||||
return l_dbus_message_new_method_return(message);
|
return l_dbus_message_new_method_return(message);
|
||||||
|
|
||||||
if (!netdev_leave_adhoc(adhoc->netdev, adhoc_leave_cb, adhoc))
|
if (netdev_leave_adhoc(adhoc->netdev, adhoc_leave_cb, adhoc))
|
||||||
return dbus_error_failed(message);
|
return dbus_error_failed(message);
|
||||||
|
|
||||||
|
adhoc->pending = l_dbus_message_ref(message);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue