From owner-p4-projects@FreeBSD.ORG Fri Jul 25 14:52:53 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 830001065675; Fri, 25 Jul 2008 14:52:53 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 46285106566C; Fri, 25 Jul 2008 14:52:53 +0000 (UTC) (envelope-from kientzle@freebsd.org) Received: from kientzle.com (h-66-166-149-50.snvacaid.covad.net [66.166.149.50]) by mx1.freebsd.org (Postfix) with ESMTP id 215B18FC12; Fri, 25 Jul 2008 14:52:52 +0000 (UTC) (envelope-from kientzle@freebsd.org) Received: (from root@localhost) by kientzle.com (8.12.9/8.12.9) id m6PEqqkH045257; Fri, 25 Jul 2008 07:52:52 -0700 (PDT) (envelope-from kientzle@freebsd.org) Received: from [10.0.0.129] (p54.kientzle.com [66.166.149.54]) by kientzle.com with SMTP; Fri, 25 Jul 2008 07:52:52 -0700 (PDT) (envelope-from kientzle@freebsd.org) Message-ID: <4889E8F1.5000006@freebsd.org> Date: Fri, 25 Jul 2008 07:53:37 -0700 From: Tim Kientzle User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.12) Gecko/20060422 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Anselm Strauss References: <200807251333.m6PDX06I079276@repoman.freebsd.org> In-Reply-To: <200807251333.m6PDX06I079276@repoman.freebsd.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: Perforce Change Reviews Subject: Re: PERFORCE change 145885 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Jul 2008 14:52:53 -0000 Anselm Strauss wrote: > http://perforce.freebsd.org/chv.cgi?CH=145885 > > Change 145885 by strauss@strauss_marvelman on 2008/07/25 13:32:02 > > Cloning archive entry instead of referencing it for data descriptors (Tim) > > Affected files ... > > .. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_write_set_format_zip.c#18 edit > .. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_write_format_zip_no_compression.c#3 edit > > Differences ... > > ==== //depot/projects/soc2008/strauss_libarchive/libarchive/archive_write_set_format_zip.c#18 (text+ko) ==== > > @@ -173,7 +173,7 @@ > archive_set_error(&a->archive, ENOMEM, "Can't allocate zip header data"); > return (ARCHIVE_FATAL); > } > - l->entry = entry; /* TODO: Maybe bad idea, do copy or store only needed fields. */ > + l->entry = archive_entry_clone(entry); > l->next = zip->central_directory; > zip->central_directory = l; Of course, this also means that the Zip writer now owns a copy of the entry and it has to free it with archive_entry_free() when it's done with it. You should change your zip write test to use archive_entry_free() to release the entry before you call archive_write_close(). I'm going to run libarchive_test under a memory debugger to see if your zip work is leaking any memory. I'll let you know what I see.