Skip to contentSkip to conversation

Fix file descriptor leak on error in iproute_flush_cache()

PATCH In review Thomas Jarosch 1 participant 1 message Oct 3, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 7/11 Fix file descriptor leak on error in iproute_flush_cache()

Detected by cppcheck.

---
 ip/iproute.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
ip/iproute.c +1 -0
index 21e1a4b..15b36e8 100644
@@ -1057,6 +1057,7 @@ static int iproute_flush_cache(void)
 
 	if ((write (flush_fd, (void *)buffer, len)) < len) {
 		fprintf (stderr, "Cannot flush routing cache\n");
+		close(flush_fd);
 		return -1;
 	}
 	close(flush_fd);
Signature · 1 line
1.7.4.4