[systemd-devel] [PATCH] libsystemd-network: avoid double-free in error case
Andreas Henriksson
andreas at fatal.se
Tue Sep 16 06:50:58 PDT 2014
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
Signed-off-by: Andreas Henriksson <andreas at fatal.se>
---
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 208c314..372f3ed 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;
}
--
2.1.0
More information about the systemd-devel
mailing list