aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Jarosch <thomas.jarosch@intra2net.com>2011-10-03 05:22:42 +0000
committerStephen Hemminger <shemminger@vyatta.com>2011-10-07 11:15:28 -0700
commit97c13582f98377c9e1a72ed40fb2b80225c4c0f9 (patch)
tree95fc02813ce9171d6f6184f4d090b4ef3ac5ee02 /lib
parent21a5a6b37892d7173f38691d1f84366840ce3917 (diff)
downloadandroid_external_iproute2-97c13582f98377c9e1a72ed40fb2b80225c4c0f9.tar.gz
android_external_iproute2-97c13582f98377c9e1a72ed40fb2b80225c4c0f9.tar.bz2
android_external_iproute2-97c13582f98377c9e1a72ed40fb2b80225c4c0f9.zip
Fix file descriptor leak on error in rtnl_hash_initialize()
Detected by cppcheck. Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/rt_names.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/rt_names.c b/lib/rt_names.c
index 30d43cd..a290021 100644
--- a/lib/rt_names.c
+++ b/lib/rt_names.c
@@ -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;
}