]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
Fix file descriptor leak on error in rtnl_hash_initialize()
authorThomas Jarosch <thomas.jarosch@intra2net.com>
Mon, 3 Oct 2011 05:22:42 +0000 (05:22 +0000)
committerStephen Hemminger <shemminger@vyatta.com>
Fri, 7 Oct 2011 18:15:28 +0000 (11:15 -0700)
Detected by cppcheck.

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

index 30d43cd000fc0aeff2cf906d56849a343e03800b..a290021b9751efb56bcbd4c0eb61ce01cf838ed9 100644 (file)
@@ -54,6 +54,7 @@ rtnl_hash_initialize(char *file, struct rtnl_hash_entry **hash, int size)
                    sscanf(p, "%d %s #", &id, namebuf) != 2) {
                        fprintf(stderr, "Database %s is corrupted at %s\n",
                                file, p);
+                       fclose(fp);
                        return;
                }
 
@@ -91,6 +92,7 @@ static void rtnl_tab_initialize(char *file, char **tab, int size)
                    sscanf(p, "%d %s #", &id, namebuf) != 2) {
                        fprintf(stderr, "Database %s is corrupted at %s\n",
                                file, p);
+                       fclose(fp);
                        return;
                }