From: Tim Kientzle Date: Thu, 25 Dec 2008 14:31:49 +0000 (-0500) Subject: Straighten out the close handling. archive_read_close() now X-Git-Tag: v2.6.0~11 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9177e3d47783eddc6a69c0f9e76b52a14c26f6c8;p=thirdparty%2Flibarchive.git Straighten out the close handling. archive_read_close() now walks the decompression filter list, invoking the close handler on each one. In particular, this means that the compress handler should not recursively invoke close on it's source. SVN-Revision: 282 --- diff --git a/libarchive/archive_read.c b/libarchive/archive_read.c index a36e0c5ed..a1f40238f 100644 --- a/libarchive/archive_read.c +++ b/libarchive/archive_read.c @@ -595,11 +595,12 @@ archive_read_close(struct archive *_a) /* TODO: Clean up the formatters. */ /* Clean up the stream pipeline. */ - if (a->source != NULL) { + while (a->source != NULL) { + struct archive_read_source *t = a->source->upstream; r1 = (a->source->close)(a->source); if (r1 < r) r = r1; - a->source = NULL; + a->source = t; } /* Release the reader objects. */ diff --git a/libarchive/archive_read_support_compression_compress.c b/libarchive/archive_read_support_compression_compress.c index 24567ae04..329173738 100644 --- a/libarchive/archive_read_support_compression_compress.c +++ b/libarchive/archive_read_support_compression_compress.c @@ -339,7 +339,6 @@ compress_source_close(struct archive_read_source *self) { struct private_data *state = (struct private_data *)self->data; - self->upstream->close(self->upstream); free(state->out_block); free(state); free(self);