Skip to content

Commit

Permalink
Revert "thdat02: don't try to free() a mapping"
Browse files Browse the repository at this point in the history
This reverts commit eae5642.

PR #119 fixes this in a better way
  • Loading branch information
DankRank committed Dec 7, 2024
1 parent 93ed316 commit 1e38aee
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions thtk/thdat02.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1e38aee

Please sign in to comment.