summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile3
-rw-r--r--lib/lz4hc.c4
2 files changed, 3 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index c3f42dd..8d23529 100644
--- a/Makefile
+++ b/Makefile
@@ -134,9 +134,6 @@ test:
$(MAKE) -C $(EXDIR) $@
.PHONY: clangtest
-clangtest: CFLAGS ?= -O3 # make's bug (http://savannah.gnu.org/bugs/?func=detailitem&item_id=59230)
-# this line has the hidden side effect of `unexport CFLAGS`
-export CFLAGS # fix the side effect by issuing export command
clangtest: CFLAGS += -Werror -Wconversion -Wno-sign-conversion
clangtest: CC = clang
clangtest: clean
diff --git a/lib/lz4hc.c b/lib/lz4hc.c
index e2e4f00..350709b 100644
--- a/lib/lz4hc.c
+++ b/lib/lz4hc.c
@@ -953,13 +953,15 @@ int LZ4_compress_HC_extStateHC (void* state, const char* src, char* dst, int src
int LZ4_compress_HC(const char* src, char* dst, int srcSize, int dstCapacity, int compressionLevel)
{
+ int cSize;
#if defined(LZ4HC_HEAPMODE) && LZ4HC_HEAPMODE==1
LZ4_streamHC_t* const statePtr = (LZ4_streamHC_t*)ALLOC(sizeof(LZ4_streamHC_t));
+ if (statePtr==NULL) return 0;
#else
LZ4_streamHC_t state;
LZ4_streamHC_t* const statePtr = &state;
#endif
- int const cSize = LZ4_compress_HC_extStateHC(statePtr, src, dst, srcSize, dstCapacity, compressionLevel);
+ cSize = LZ4_compress_HC_extStateHC(statePtr, src, dst, srcSize, dstCapacity, compressionLevel);
#if defined(LZ4HC_HEAPMODE) && LZ4HC_HEAPMODE==1
FREEMEM(statePtr);
#endif