* [PATCH] netconfig: fix freeing invalid pointer
@ 2020-11-23 23:05 James Prestwood
2020-11-24 5:30 ` Denis Kenzior
0 siblings, 1 reply; 2+ messages in thread
From: James Prestwood @ 2020-11-23 23:05 UTC (permalink / raw)
To: iwd
[-- 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
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-11-24 5:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-23 23:05 [PATCH] netconfig: fix freeing invalid pointer James Prestwood
2020-11-24 5:30 ` Denis Kenzior
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.