From 2dfe454fb600d0921a353471ebac6491532608db Mon Sep 17 00:00:00 2001 From: prot0man Date: Tue, 16 Jan 2024 17:31:39 -0500 Subject: [PATCH] FIXUP fixed double free issue. Calls to zip_stream_close free the buffer provided in zip_stream_open. Because of all of the internal reallocs that may happen on the buffer passed to zip_stream_open, I think the cleanest flow is that the user expects zip_stream_open to take management of their buffer and then get the updated zip via zip_stream_copy as a new buffer. --- test/test_entry.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_entry.c b/test/test_entry.c index 7fae49d8..009f07b6 100644 --- a/test/test_entry.c +++ b/test/test_entry.c @@ -424,8 +424,8 @@ MU_TEST(test_entries_delete_stream) { zip_stream_copy(zip, (void **)&modified_zdata, &zsize); mu_check(modified_zdata != NULL); + // Note that zip_stream_close will free the zdata passed in zip_stream_open zip_stream_close(zip); - free(zdata); zdata = NULL; zip = zip_stream_open(modified_zdata, zsize, 0, 'r');