Skip to content

Commit

Permalink
Merge pull request #1005 from ITotalJustice/fix_LZ4HC_HEAPMODE_macro
Browse files Browse the repository at this point in the history
fix LZ4HC_HEAPMODE macro guard
  • Loading branch information
Cyan4973 committed Jun 25, 2021
2 parents e3082cd + 2216d45 commit 11efc95
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/lz4hc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1331,7 +1331,7 @@ static int LZ4HC_compress_optimal ( LZ4HC_CCtx_internal* ctx,
{
int retval = 0;
#define TRAILING_LITERALS 3
#ifdef LZ4HC_HEAPMODE
#if defined(LZ4HC_HEAPMODE) && LZ4HC_HEAPMODE==1
LZ4HC_optimal_t* const opt = (LZ4HC_optimal_t*)ALLOC(sizeof(LZ4HC_optimal_t) * (LZ4_OPT_NUM + TRAILING_LITERALS));
#else
LZ4HC_optimal_t opt[LZ4_OPT_NUM + TRAILING_LITERALS]; /* ~64 KB, which is a bit large for stack... */
Expand All @@ -1349,7 +1349,7 @@ static int LZ4HC_compress_optimal ( LZ4HC_CCtx_internal* ctx,
const BYTE* ovref = NULL;

/* init */
#ifdef LZ4HC_HEAPMODE
#if defined(LZ4HC_HEAPMODE) && LZ4HC_HEAPMODE==1
if (opt == NULL) goto _return_label;
#endif
DEBUGLOG(5, "LZ4HC_compress_optimal(dst=%p, dstCapa=%u)", dst, (unsigned)dstCapacity);
Expand Down Expand Up @@ -1614,7 +1614,7 @@ if (limit == fillOutput) {
goto _last_literals;
}
_return_label:
#ifdef LZ4HC_HEAPMODE
#if defined(LZ4HC_HEAPMODE) && LZ4HC_HEAPMODE==1
FREEMEM(opt);
#endif
return retval;
Expand Down

0 comments on commit 11efc95

Please sign in to comment.