From 5a3f198964dbc6fcf9157f1673689698ae89a3bf Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Tue, 17 Jun 2014 19:40:12 +0200 Subject: [PATCH] networkd: veth - fix memleak --- src/libsystemd-network/network-internal.c | 9 ++++----- src/network/networkd-netdev.c | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libsystemd-network/network-internal.c b/src/libsystemd-network/network-internal.c index e9146d0..2e9667c 100644 --- a/src/libsystemd-network/network-internal.c +++ b/src/libsystemd-network/network-internal.c @@ -179,7 +179,7 @@ int config_parse_ifname(const char *unit, void *userdata) { char **s = data; - char *n; + _cleanup_free_ char *n = NULL; assert(filename); assert(lvalue); @@ -198,12 +198,11 @@ int config_parse_ifname(const char *unit, } free(*s); - if (*n) + if (*n) { *s = n; - else { - free(n); + n = NULL; + } else *s = NULL; - } return 0; } diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c index 5359eb1..8879e08 100644 --- a/src/network/networkd-netdev.c +++ b/src/network/networkd-netdev.c @@ -94,6 +94,7 @@ static void netdev_free(NetDev *netdev) { free(netdev->description); free(netdev->ifname); + free(netdev->ifname_peer); free(netdev->mac); free(netdev->mac_peer); -- 2.7.4