Skip to contentSkip to conversation

Fix file descriptor leak in channel_open() on error

PATCH Applied Thomas Jarosch 2 participants 2 messages Dec 10, 2014 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix file descriptor leak in channel_open() on error

Detected by cppcheck

---
 src/channel.c | 1 +
 1 file changed, 1 insertion(+)
src/channel.c +1 -0
index 8b7c319..acbfa7d 100644
@@ -109,6 +109,7 @@ channel_open(struct channel_conf *cfg)
 
 	if (ioctl(fd, SIOCGIFMTU, &ifr) == -1) {
 		free(c);
+		close(fd);
 		return NULL;
 	}
 	close(fd);
Signature · 1 line
1.9.3
maintainer Applied
#1 lore raw
Quoted 1 line · Thomas Jarosch

Detected by cppcheck

Applied, thanks Thomas.