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 Use archive_read_finish...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/bb17f6790616
branches:  trunk
changeset: 555811:bb17f6790616
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Mon Mar 09 20:01:22 2009 +0000

description:
Use archive_read_finish and avoid double-free if the archive couldn't be
opened.

diffstat:

 pkgtools/pkg_install/files/lib/pkg_io.c |  7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diffs (28 lines):

diff -r a20d97d6a924 -r bb17f6790616 pkgtools/pkg_install/files/lib/pkg_io.c
--- a/pkgtools/pkg_install/files/lib/pkg_io.c   Mon Mar 09 19:58:45 2009 +0000
+++ b/pkgtools/pkg_install/files/lib/pkg_io.c   Mon Mar 09 20:01:22 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pkg_io.c,v 1.6 2009/03/08 14:50:37 joerg Exp $ */
+/*     $NetBSD: pkg_io.c,v 1.7 2009/03/09 20:01:22 joerg Exp $ */
 /*-
  * Copyright (c) 2008 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
  * All rights reserved.
@@ -36,7 +36,7 @@
 #include <sys/cdefs.h>
 #endif
 
-__RCSID("$NetBSD: pkg_io.c,v 1.6 2009/03/08 14:50:37 joerg Exp $");
+__RCSID("$NetBSD: pkg_io.c,v 1.7 2009/03/09 20:01:22 joerg Exp $");
 
 #include <archive.h>
 #include <archive_entry.h>
@@ -111,8 +111,7 @@
        archive_read_support_format_all(a);
        if (archive_read_open(a, f, fetch_archive_open, fetch_archive_read,
            fetch_archive_close)) {
-               archive_read_close(a);
-               free(f);
+               archive_read_finish(a);
                return NULL;
        }
 



Home | Main Index | Thread Index | Old Index