From: Eric Sesterhenn Date: Mon, 2 Nov 2009 09:46:38 +0000 (+0100) Subject: fix fd leak in phy_lookup() X-Git-Tag: v0.9.18~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8f253ee224f6fb64e8f6fb0a2571e4ed244cc6ee;p=thirdparty%2Fiw.git fix fd leak in phy_lookup() --- diff --git a/iw.c b/iw.c index 8fcf2f6..562f17b 100644 --- a/iw.c +++ b/iw.c @@ -223,9 +223,12 @@ static int phy_lookup(char *name) if (fd < 0) return -1; pos = read(fd, buf, sizeof(buf) - 1); - if (pos < 0) + if (pos < 0) { + close(fd); return -1; + } buf[pos] = '\0'; + close(fd); return atoi(buf); }