We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b4023a7 commit eae5642Copy full SHA for eae5642
thtk/thdat02.c
@@ -138,7 +138,13 @@ th02_read(
138
ret = thtk_io_write(output, data, entry->zsize, error);
139
thtk_io_unmap(thdat->stream, data);
140
} else {
141
- thtk_io_t* data_stream = thtk_io_open_memory(data, entry->zsize, error);
+ /* FIXME: ouch, an unnecessary copy, due to thtk_io_open_memory taking ownership */
142
+ void *data2 = malloc(entry->zsize);
143
+ if (!data2)
144
+ return -1;
145
+ memcpy(data2, data, entry->zsize);
146
+
147
+ thtk_io_t* data_stream = thtk_io_open_memory(data2, entry->zsize, error);
148
if (!data_stream)
149
return -1;
150
ret = thtk_unrle(data_stream, entry->zsize, output, error);
0 commit comments