dcavalca / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone
Zbigniew Jędrzejewski-Szmek 62fe94
From 2833796106420e4634543d06052482f75cbb5762 Mon Sep 17 00:00:00 2001
Zbigniew Jędrzejewski-Szmek 62fe94
From: Andreas Henriksson <andreas@fatal.se>
Zbigniew Jędrzejewski-Szmek 62fe94
Date: Tue, 16 Sep 2014 15:50:58 +0200
Zbigniew Jędrzejewski-Szmek 62fe94
Subject: [PATCH] libsystemd-network: avoid double-free in error case
Zbigniew Jędrzejewski-Szmek 62fe94
Zbigniew Jędrzejewski-Szmek 62fe94
Don't manually free 'n' in error path as it's already tagged
Zbigniew Jędrzejewski-Szmek 62fe94
_cleanup_free_ and will be freed once it goes out of scope,
Zbigniew Jędrzejewski-Szmek 62fe94
leading to double-free in this case.
Zbigniew Jędrzejewski-Szmek 62fe94
Zbigniew Jędrzejewski-Szmek 62fe94
Found with coverity. Fixes: CID#1237786
Zbigniew Jędrzejewski-Szmek 62fe94
---
Zbigniew Jędrzejewski-Szmek 62fe94
 src/libsystemd-network/network-internal.c | 1 -
Zbigniew Jędrzejewski-Szmek 62fe94
 1 file changed, 1 deletion(-)
Zbigniew Jędrzejewski-Szmek 62fe94
Zbigniew Jędrzejewski-Szmek 62fe94
diff --git a/src/libsystemd-network/network-internal.c b/src/libsystemd-network/network-internal.c
Zbigniew Jędrzejewski-Szmek 62fe94
index 208c314695..372f3ed371 100644
Zbigniew Jędrzejewski-Szmek 62fe94
--- a/src/libsystemd-network/network-internal.c
Zbigniew Jędrzejewski-Szmek 62fe94
+++ b/src/libsystemd-network/network-internal.c
Zbigniew Jędrzejewski-Szmek 62fe94
@@ -199,7 +199,6 @@ int config_parse_ifname(const char *unit,
Zbigniew Jędrzejewski-Szmek 62fe94
         if (!ascii_is_valid(n) || strlen(n) >= IFNAMSIZ) {
Zbigniew Jędrzejewski-Szmek 62fe94
                 log_syntax(unit, LOG_ERR, filename, line, EINVAL,
Zbigniew Jędrzejewski-Szmek 62fe94
                            "Interface name is not ASCII clean or is too long, ignoring assignment: %s", rvalue);
Zbigniew Jędrzejewski-Szmek 62fe94
-                free(n);
Zbigniew Jędrzejewski-Szmek 62fe94
                 return 0;
Zbigniew Jędrzejewski-Szmek 62fe94
         }
Zbigniew Jędrzejewski-Szmek 62fe94