commit ccf265b943edf5e51206108875cae496e730c1d5
parent ebc42ccecf6892ef0009261dbc8e9a2012c2a2fc
Author: James Prestwood <prestwoj@gmail.com>
Date: Mon, 23 Nov 2020 15:05:54 -0800
netconfig: fix freeing invalid pointer
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.
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git 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,