Fix file descriptor leak on error in rtnl_hash_initialize()
Detected by cppcheck.
Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
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 @@
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 @@
sscanf(p, "%d %s #", &id, namebuf) != 2) {
fprintf(stderr, "Database %s is corrupted at %s\n",
file, p);
+ fclose(fp);
return;
}