Skip to content

Commit b77bdca

Browse files
committed
Fix memory leaks
1 parent 19f3878 commit b77bdca

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

blosc/blosc2.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,10 @@ static int openzl_wrap_compress(struct thread_context* thread_context,
600600

601601
code = ZL_CCtx_compressTypedRef(thread_context->openzl_cctx, output, maxout, input_);
602602

603+
// Cleanup
604+
ZL_TypedRef_free(input_);
605+
ZL_Compressor_free(compressor);
606+
603607
if (ZL_isError(code)) {
604608
return 0;
605609
}
@@ -618,6 +622,9 @@ static int openzl_wrap_decompress(struct thread_context* thread_context,
618622
ZL_TypedBuffer* tbuffer = ZL_TypedBuffer_createWrapSerial((void*)output, maxout);
619623
ZL_Report code = ZL_DCtx_decompressTBuffer(thread_context->openzl_dctx, tbuffer, (void*)input, compressed_length);
620624

625+
// Cleanup
626+
ZL_TypedBuffer_free(tbuffer);
627+
621628
if (ZL_isError(code)) {
622629
BLOSC_TRACE_ERROR("Error in OpenZL decompression: '%s'. Giving up.", ZL_errorCode(code));
623630
return 0;

0 commit comments

Comments
 (0)