scan: Call .destroy in scan_request_free

The main difference with this is that scan_context removal will also
trigger the .destroy calls.  Normally there won't be any requests left
during scan_context but if there were any we should call destroy on
them.
This commit is contained in:
Andrew Zaborowski 2018-11-29 19:56:00 +01:00 committed by Denis Kenzior
parent c9d8346d40
commit 0d3f16ec5e
1 changed files with 3 additions and 3 deletions

View File

@ -119,6 +119,9 @@ static void scan_request_free(void *data)
{
struct scan_request *sr = data;
if (sr->destroy)
sr->destroy(sr->userdata);
l_queue_destroy(sr->cmds, (l_queue_destroy_func_t) l_genl_msg_unref);
l_free(sr);
@ -129,9 +132,6 @@ static void scan_request_trigger_failed(struct scan_request *sr, int err)
if (sr->trigger)
sr->trigger(err, sr->userdata);
if (sr->destroy)
sr->destroy(sr->userdata);
scan_request_free(sr);
}