From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.01.org
Subject: [PATCH] netconfig: fix freeing invalid pointer
Date: Mon, 23 Nov 2020 15:05:54 -0800 [thread overview]
Message-ID: <20201123230554.4119658-1-prestwoj@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 855 bytes --]
If l_rtnl_ifaddr4_extract does not set the values they would
get freed. Instead initialize to NULL so the cleanup free is
a no op.
---
src/netconfig.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/netconfig.c b/src/netconfig.c
index dcb88749..610635cd 100644
--- a/src/netconfig.c
+++ b/src/netconfig.c
@@ -441,9 +441,9 @@ static void netconfig_ifaddr_added(struct netconfig *netconfig,
const struct ifaddrmsg *ifa,
uint32_t len)
{
- L_AUTO_FREE_VAR(char *, label);
- L_AUTO_FREE_VAR(char *, ip);
- L_AUTO_FREE_VAR(char *, broadcast);
+ L_AUTO_FREE_VAR(char *, label) = NULL;
+ L_AUTO_FREE_VAR(char *, ip) = NULL;
+ L_AUTO_FREE_VAR(char *, broadcast) = NULL;
l_rtnl_ifaddr4_extract(ifa, len, &label, &ip, &broadcast);
l_debug("%s: ifaddr %s/%u broadcast %s", label,
--
2.26.2
next reply other threads:[~2020-11-23 23:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-23 23:05 James Prestwood [this message]
2020-11-24 5:30 ` [PATCH] netconfig: fix freeing invalid pointer 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=20201123230554.4119658-1-prestwoj@gmail.com \
--to=prestwoj@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox