]> rtime.felk.cvut.cz Git - lisovros/iproute2_canprio.git/commitdiff
Fix file descriptor leak on error in read_viftable()
authorThomas Jarosch <thomas.jarosch@intra2net.com>
Mon, 3 Oct 2011 05:24:08 +0000 (05:24 +0000)
committerStephen Hemminger <shemminger@vyatta.com>
Fri, 7 Oct 2011 18:18:41 +0000 (11:18 -0700)
Detected by cppcheck.

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
ip/ipmroute.c

index a4389f578786c0d3d4fd193168b51b7d499e0f5e..f033349b57ccea96ebbc25f3dd3cb8406ee7848a 100644 (file)
@@ -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];