chiark / gitweb /
libsystemd-network: avoid double-free in error case
authorAndreas Henriksson <andreas@fatal.se>
Tue, 16 Sep 2014 13:50:58 +0000 (15:50 +0200)
committerTom Gundersen <teg@jklm.no>
Tue, 16 Sep 2014 14:20:41 +0000 (16:20 +0200)
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

index 208c314695ad5fa601a6acbfadd9956b8d60d85c..372f3ed371e0279413ba7f963b066ec06b2efc68 100644 (file)
@@ -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;
         }