Module Name:    src
Committed By:   wiz
Date:           Wed Jan  5 00:09:43 UTC 2011

Modified Files:
        src/lib/libc/net: hesiod.c

Log Message:
Fix fdleak in error case. Found by cppcheck.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/lib/libc/net/hesiod.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/net/hesiod.c
diff -u src/lib/libc/net/hesiod.c:1.24 src/lib/libc/net/hesiod.c:1.25
--- src/lib/libc/net/hesiod.c:1.24	Wed Oct 19 22:56:42 2005
+++ src/lib/libc/net/hesiod.c	Wed Jan  5 00:09:43 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: hesiod.c,v 1.24 2005/10/19 22:56:42 christos Exp $	*/
+/*	$NetBSD: hesiod.c,v 1.25 2011/01/05 00:09:43 wiz Exp $	*/
 
 /* Copyright (c) 1996 by Internet Software Consortium.
  *
@@ -51,7 +51,7 @@
     "#Id: hesiod_p.h,v 1.1 1996/12/08 21:39:37 ghudson Exp #");
 __IDSTRING(rcsid_hescompat_c,
     "#Id: hescompat.c,v 1.1.2.1 1996/12/16 08:37:45 ghudson Exp #");
-__RCSID("$NetBSD: hesiod.c,v 1.24 2005/10/19 22:56:42 christos Exp $");
+__RCSID("$NetBSD: hesiod.c,v 1.25 2011/01/05 00:09:43 wiz Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -378,6 +378,7 @@
 			*which = strdup(data);
 			if (!*which) {
 				errno = ENOMEM;
+				(void)fclose(fp);
 				return -1;
 			}
 		} else {

Reply via email to