diff options
author | wiz <wiz> | 2006-04-04 06:37:15 +0000 |
---|---|---|
committer | wiz <wiz> | 2006-04-04 06:37:15 +0000 |
commit | 73279a37f1b2daa8246ad3229420e24d311b95ef (patch) | |
tree | fe33c1f290689189f95f5919b3b28898a4416768 /pkgtools | |
parent | 1fe17974ee1c4bf8dd280eb9329c661a0ac6c39c (diff) | |
download | pkgsrc-73279a37f1b2daa8246ad3229420e24d311b95ef.tar.gz |
Pull over v1.4 from src/usr.sbin:
revision 1.4
date: 2006/03/17 01:10:53; author: hubertf; state: Exp; lines: +5 -2
Fix filedescriptor leak
Coverity CID 1625
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/pkg_install/files/lib/var.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pkgtools/pkg_install/files/lib/var.c b/pkgtools/pkg_install/files/lib/var.c index 863798e4bb4..1a8e68f969f 100644 --- a/pkgtools/pkg_install/files/lib/var.c +++ b/pkgtools/pkg_install/files/lib/var.c @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.2 2005/11/06 12:37:43 wiz Exp $ */ +/* $NetBSD: var.c,v 1.3 2006/04/04 06:37:15 wiz Exp $ */ /*- * Copyright (c) 2005 The NetBSD Foundation, Inc. @@ -40,7 +40,7 @@ #include <sys/cdefs.h> #endif #ifndef lint -__RCSID("$NetBSD: var.c,v 1.2 2005/11/06 12:37:43 wiz Exp $"); +__RCSID("$NetBSD: var.c,v 1.3 2006/04/04 06:37:15 wiz Exp $"); #endif #if HAVE_SYS_STAT_H @@ -135,12 +135,14 @@ var_set(const char *fname, const char *variable, const char *value) sprintf(tmpname, "%s.XXXXXX", fname); if ((fd=mkstemp(tmpname)) < 0) { free(tmpname); + fclose(fp); warn("var_set: can't open temp file for '%s' for writing", fname); return -1; } if (chmod(tmpname, 0644) < 0) { close(fd); + fclose(fp); free(tmpname); warn("var_set: can't set permissions for temp file for '%s'", fname); @@ -150,6 +152,7 @@ var_set(const char *fname, const char *variable, const char *value) close(fd); remove(tmpname); free(tmpname); + fclose(fp); warn("var_set: can't open temp file for '%s' for writing", fname); return -1; |