dcavalca / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone
Blob Blame History Raw
From 2833796106420e4634543d06052482f75cbb5762 Mon Sep 17 00:00:00 2001
From: Andreas Henriksson <andreas@fatal.se>
Date: Tue, 16 Sep 2014 15:50:58 +0200
Subject: [PATCH] libsystemd-network: avoid double-free in error case

Don't manually free 'n' in error path as it's already tagged
_cleanup_free_ and will be freed once it goes out of scope,
leading to double-free in this case.

Found with coverity. Fixes: CID#1237786
---
 src/libsystemd-network/network-internal.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/libsystemd-network/network-internal.c b/src/libsystemd-network/network-internal.c
index 208c314695..372f3ed371 100644
--- a/src/libsystemd-network/network-internal.c
+++ b/src/libsystemd-network/network-internal.c
@@ -199,7 +199,6 @@ int config_parse_ifname(const char *unit,
         if (!ascii_is_valid(n) || strlen(n) >= IFNAMSIZ) {
                 log_syntax(unit, LOG_ERR, filename, line, EINVAL,
                            "Interface name is not ASCII clean or is too long, ignoring assignment: %s", rvalue);
-                free(n);
                 return 0;
         }