All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Zaborowski <andrew.zaborowski@intel.com>
To: iwd@lists.01.org
Subject: [PATCH 3/5] ap: Move the DHCP server freeing to ap_reset
Date: Tue, 02 Mar 2021 13:08:11 +0100	[thread overview]
Message-ID: <20210302120813.757731-3-andrew.zaborowski@intel.com> (raw)
In-Reply-To: <20210302120813.757731-1-andrew.zaborowski@intel.com>

[-- Attachment #1: Type: text/plain, Size: 865 bytes --]

Some callers of ap_reset(ap)/l_free(ap) would not call
l_dhcp_server_destroy() causing some likely leaks.  It's easier to call
it directly from inside ap_reset().
---
 src/ap.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/ap.c b/src/ap.c
index c5e6c43e..5425823a 100644
--- a/src/ap.c
+++ b/src/ap.c
@@ -250,8 +250,10 @@ static void ap_reset(struct ap_state *ap)
 	if (ap->own_ip)
 		l_free(ap->own_ip);
 
-	if (ap->server)
-		l_dhcp_server_stop(ap->server);
+	if (ap->server) {
+		l_dhcp_server_destroy(ap->server);
+		ap->server = NULL;
+	}
 
 	if (ap->profile) {
 		l_settings_free(ap->profile);
@@ -3075,8 +3077,6 @@ void ap_free(struct ap_state *ap)
 {
 	ap_reset(ap);
 	l_genl_family_free(ap->nl80211);
-	if (ap->server)
-		l_dhcp_server_destroy(ap->server);
 	l_free(ap);
 }
 
-- 
2.27.0

  parent reply	other threads:[~2021-03-02 12:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-02 12:08 [PATCH 1/5] ap: Refactor IP address selection Andrew Zaborowski
2021-03-02 12:08 ` [PATCH 2/5] ap: Send a specific error message on async AP start failure Andrew Zaborowski
2021-03-02 12:08 ` Andrew Zaborowski [this message]
2021-03-02 12:08 ` [PATCH 4/5] autotests: Update APRanges usage in testAP Andrew Zaborowski
2021-03-02 12:08 ` [PATCH 5/5] doc: Update AP settings in iwd.ap and iwd.config(5) Andrew Zaborowski
2021-03-03 17:14 ` [PATCH 1/5] ap: Refactor IP address selection Denis Kenzior
2021-03-03 19:17   ` Andrew Zaborowski
2021-03-03 20:30     ` Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210302120813.757731-3-andrew.zaborowski@intel.com \
    --to=andrew.zaborowski@intel.com \
    --cc=iwd@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.