fix scope of scan-build tests

exclude zlib code
This commit is contained in:
Yann Collet 2018-08-15 17:41:44 -07:00
parent da55865e47
commit 5291d9ac31
2 changed files with 7 additions and 5 deletions

View File

@ -44,8 +44,7 @@ all32:
$(MAKE) -C $(TESTDIR) all32
.PHONY: lib lib-release libzstd.a
lib : libzstd.a
lib lib-release libzstd.a:
lib lib-release :
@$(MAKE) -C $(ZSTDDIR) $@
.PHONY: zstd zstd-release
@ -59,7 +58,7 @@ zstdmt:
cp $(PRGDIR)/zstd$(EXT) ./zstdmt$(EXT)
.PHONY: zlibwrapper
zlibwrapper: libzstd.a
zlibwrapper: lib
$(MAKE) -C $(ZWRAPDIR) all
.PHONY: test
@ -351,7 +350,9 @@ bmi32build: clean
$(CC) -v
CFLAGS="-O3 -mbmi -m32 -Werror" $(MAKE) -C $(TESTDIR) test
# static analyzer test uses clang's scan-build
# does not analyze zlibWrapper, due to detected issues in zlib source code
staticAnalyze:
$(CC) -v
CC=$(CC) CPPFLAGS=-g scan-build --status-bugs -v $(MAKE) all
CC=$(CC) CPPFLAGS=-g scan-build --status-bugs -v $(MAKE) allzstd examples contrib
endif

View File

@ -2399,6 +2399,7 @@ static size_t ZSTD_initDDict_internal(ZSTD_DDict* ddict,
if ((dictLoadMethod == ZSTD_dlm_byRef) || (!dict) || (!dictSize)) {
ddict->dictBuffer = NULL;
ddict->dictContent = dict;
if (!dict) dictSize = 0;
} else {
void* const internalBuffer = ZSTD_malloc(dictSize, ddict->cMem);
ddict->dictBuffer = internalBuffer;