summaryrefslogtreecommitdiff
path: root/src/libsystemd-network
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-06-17 19:40:12 +0200
committerTom Gundersen <teg@jklm.no>2014-06-17 23:21:31 +0200
commit5a3f198964dbc6fcf9157f1673689698ae89a3bf (patch)
treef46854d24b3fd0fad48102dc29b0c309ce369075 /src/libsystemd-network
parentde228aabc833901e7c75aab8d62e58229e2a8bfc (diff)
networkd: veth - fix memleak
Diffstat (limited to 'src/libsystemd-network')
-rw-r--r--src/libsystemd-network/network-internal.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/libsystemd-network/network-internal.c b/src/libsystemd-network/network-internal.c
index e9146d0e54..2e9667c167 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;
}