From: Thomas Jarosch Date: Mon, 3 Oct 2011 05:24:08 +0000 (+0000) Subject: Fix file descriptor leak on error in read_viftable() X-Git-Tag: v3.0.0~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=67ef60a29333784d09245762e8270727cc758945;p=thirdparty%2Fiproute2.git Fix file descriptor leak on error in read_viftable() Detected by cppcheck. Signed-off-by: Thomas Jarosch --- diff --git a/ip/ipmroute.c b/ip/ipmroute.c index a4389f578..f033349b5 100644 --- a/ip/ipmroute.c +++ b/ip/ipmroute.c @@ -58,9 +58,10 @@ static void read_viftable(void) if (!fp) return; - if (!fgets(buf, sizeof(buf), fp)) + if (!fgets(buf, sizeof(buf), fp)) { + fclose(fp); return; - + } while (fgets(buf, sizeof(buf), fp)) { int vifi; char dev[256];