From 1e38aeed98f3bad09d2583ca05bfe0ba9c13c1db Mon Sep 17 00:00:00 2001 From: Egor Date: Sat, 7 Dec 2024 11:29:26 +0200 Subject: [PATCH] Revert "thdat02: don't try to free() a mapping" This reverts commit eae5642caf20cf41299929a77d8cd42871821483. PR #119 fixes this in a better way --- thtk/thdat02.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/thtk/thdat02.c b/thtk/thdat02.c index 8488d399..6dbda59a 100644 --- a/thtk/thdat02.c +++ b/thtk/thdat02.c @@ -141,13 +141,7 @@ th02_read( ret = thtk_io_write(output, data, entry->zsize, error); free(data); } else { - /* FIXME: ouch, an unnecessary copy, due to thtk_io_open_memory taking ownership */ - void *data2 = malloc(entry->zsize); - if (!data2) - return -1; - memcpy(data2, data, entry->zsize); - - thtk_io_t* data_stream = thtk_io_open_memory(data2, entry->zsize, error); + thtk_io_t* data_stream = thtk_io_open_memory(data, entry->zsize, error); if (!data_stream) return -1; ret = thtk_unrle(data_stream, entry->zsize, output, error);