Skip to content

Commit

Permalink
remove possible mem leak in error cases by brotli compression too
Browse files Browse the repository at this point in the history
  • Loading branch information
sebres committed Sep 27, 2023
1 parent 396505c commit fa7e631
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions C/zstdmt/brotli-mt_compress.c
Expand Up @@ -480,6 +480,15 @@ size_t BROTLIMT_compressCCtx(BROTLIMT_CCtx * ctx, BROTLIMT_RdWr_t * rdwr)
retval_of_thread = p;
}

/* move remaining done/busy entries to free list */
while (!list_empty(&ctx->writelist_done)) {
struct list_head *entry = list_first(&ctx->writelist_done);
list_move(entry, &ctx->writelist_free);
}
while (!list_empty(&ctx->writelist_busy)) {
struct list_head* entry = list_first(&ctx->writelist_busy);
list_move(entry, &ctx->writelist_free);
}
/* clean up lists */
while (!list_empty(&ctx->writelist_free)) {
struct writelist *wl;
Expand Down

0 comments on commit fa7e631

Please sign in to comment.