netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [iproute2 PATCH 02/11] Fix file descriptor leak on error in rtnl_hash_initialize()
@ 2011-10-03 15:22 Thomas Jarosch
  0 siblings, 0 replies; only message in thread
From: Thomas Jarosch @ 2011-10-03 15:22 UTC (permalink / raw)
  To: netdev

Detected by cppcheck.

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
---
 lib/rt_names.c |    2 ++
 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;
 		}
 
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-10-03 15:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-03 15:22 [iproute2 PATCH 02/11] Fix file descriptor leak on error in rtnl_hash_initialize() Thomas Jarosch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).