From: Thomas Jarosch Date: Mon, 3 Oct 2011 05:24:18 +0000 (+0000) Subject: Fix file descriptor leak on error in read_mroute_list() X-Git-Tag: v3.0.0~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e588a7db167df75e659f99bd3b024eedafed62cc;p=thirdparty%2Fiproute2.git Fix file descriptor leak on error in read_mroute_list() Detected by cppcheck. Signed-off-by: Thomas Jarosch --- diff --git a/ip/ipmroute.c b/ip/ipmroute.c index f033349b5..945727d3d 100644 --- a/ip/ipmroute.c +++ b/ip/ipmroute.c @@ -85,8 +85,10 @@ static void read_mroute_list(FILE *ofp) if (!fp) return; - if (!fgets(buf, sizeof(buf), fp)) + if (!fgets(buf, sizeof(buf), fp)) { + fclose(fp); return; + } while (fgets(buf, sizeof(buf), fp)) { inet_prefix maddr, msrc;