]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
Fix a memory leak
authorVincent Bernat <bernat@luffy.cx>
Sun, 16 Nov 2008 21:14:03 +0000 (22:14 +0100)
committerVincent Bernat <bernat@luffy.cx>
Sun, 16 Nov 2008 21:14:03 +0000 (22:14 +0100)
src/priv.c

index 67ccb2c5fd9a2ef8bd7cf68aa3bbdb16bfa897de..31d7e69151d29ac9c487c84b0138def1f3a79bb5 100644 (file)
@@ -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)&ethc;
        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;
        }