From aabbb9ac61e31a4481407ebb4ad46a2aca92b2d8 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sun, 16 Nov 2008 22:14:03 +0100 Subject: [PATCH] Fix a memory leak --- src/priv.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/priv.c b/src/priv.c index 67ccb2c5..31d7e691 100644 --- a/src/priv.c +++ b/src/priv.c @@ -306,12 +306,13 @@ asroot_ethtool() must_read(remote, ifname, len); ifname[len] = '\0'; strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); + free(ifname); ifr.ifr_data = (caddr_t)ðc; ethc.cmd = ETHTOOL_GSET; if ((rc = ioctl(sock, SIOCETHTOOL, &ifr)) != 0) { - LLOG_DEBUG("[priv]: unable to ioctl ETHTOOL for %s", ifname); + LLOG_DEBUG("[priv]: unable to ioctl ETHTOOL for %s", + ifr.ifr_name); must_write(remote, &rc, sizeof(int)); - free(ifname); close(sock); return; } -- 2.39.5