]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
xz: Properly clean up resources on error path 3116/head
authorTobias Stoeckmann <tobias@stoeckmann.org>
Sat, 6 Jun 2026 09:40:19 +0000 (11:40 +0200)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Sat, 6 Jun 2026 09:40:19 +0000 (11:40 +0200)
If vtable is not set to NULL, close function would be called during
shutdown. Since data is already freed and set to NULL, this would lead
to a NULL pointer dereference later on.

The called library functions should never fail though, so this is a
purely defensive measure against future lzma changes.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
libarchive/archive_read_support_filter_xz.c

index 1fff30ab3c343108b75b19c0e7dd97714e4fd14a..501a4772b4feaf435efa07838001a9bdbe9cebaa 100644 (file)
@@ -524,6 +524,7 @@ xz_lzma_bidder_init(struct archive_read_filter *self)
        free(state->out_block);
        free(state);
        self->data = NULL;
+       self->vtable = NULL;
        return (ARCHIVE_FATAL);
 }