From 0d3f16ec5ece7b268a228c2faaa155976fcc214c Mon Sep 17 00:00:00 2001 From: Andrew Zaborowski Date: Thu, 29 Nov 2018 19:56:00 +0100 Subject: [PATCH] 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. --- src/scan.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/scan.c b/src/scan.c index 283e7a6e..abcf70e5 100644 --- a/src/scan.c +++ b/src/scan.c @@ -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); }