Fix fdleak in error case. Found by cppcheck.

This commit is contained in:
wiz 2011-01-05 00:09:43 +00:00
parent e97508602c
commit aff1729a2c
2 changed files with 6 additions and 4 deletions

View File

@ -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 @@ __IDSTRING(rcsid_hesiod_p_h,
"#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 @@ read_config_file(ctx, filename)
*which = strdup(data);
if (!*which) {
errno = ENOMEM;
(void)fclose(fp);
return -1;
}
} else {

View File

@ -1,4 +1,4 @@
/* $NetBSD: rumpuser.c,v 1.10 2010/11/15 15:23:32 pooka Exp $ */
/* $NetBSD: rumpuser.c,v 1.11 2011/01/05 00:19:20 wiz Exp $ */
/*
* Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved.
@ -27,7 +27,7 @@
#include <sys/cdefs.h>
#if !defined(lint)
__RCSID("$NetBSD: rumpuser.c,v 1.10 2010/11/15 15:23:32 pooka Exp $");
__RCSID("$NetBSD: rumpuser.c,v 1.11 2011/01/05 00:19:20 wiz Exp $");
#endif /* !lint */
/* thank the maker for this */
@ -159,6 +159,7 @@ rumpuser_getfileinfo(const char *path, uint64_t *sizep, int *ftp, int *error)
if (ioctl(fd, DIOCGDINFO, &lab) == -1) {
seterror(errno);
(void)close(fd);
rv = -1;
goto out;
}