pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_install/files/lib Pull over v1.4 from src...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/561887c3da4b
branches:  trunk
changeset: 510786:561887c3da4b
user:      wiz <wiz%pkgsrc.org@localhost>
date:      Tue Apr 04 06:37:15 2006 +0000

description:
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:

 pkgtools/pkg_install/files/lib/var.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (41 lines):

diff -r 153112d1bd9a -r 561887c3da4b pkgtools/pkg_install/files/lib/var.c
--- a/pkgtools/pkg_install/files/lib/var.c      Tue Apr 04 06:36:12 2006 +0000
+++ b/pkgtools/pkg_install/files/lib/var.c      Tue Apr 04 06:37:15 2006 +0000
@@ -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 @@
        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 @@
                close(fd);
                remove(tmpname);
                free(tmpname);
+               fclose(fp);
                warn("var_set: can't open temp file for '%s' for writing",
                      fname);
                return -1;



Home | Main Index | Thread Index | Old Index