Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Jul 2008 07:53:37 -0700
From:      Tim Kientzle <kientzle@freebsd.org>
To:        Anselm Strauss <strauss@freebsd.org>
Cc:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   Re: PERFORCE change 145885 for review
Message-ID:  <4889E8F1.5000006@freebsd.org>
In-Reply-To: <200807251333.m6PDX06I079276@repoman.freebsd.org>
References:  <200807251333.m6PDX06I079276@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4889E8F1.5000006>