fix memory leaks

This commit is contained in:
Przemyslaw Skibinski 2017-02-21 18:17:24 +01:00
parent 3a751edeae
commit 684858e7b7
4 changed files with 22 additions and 16 deletions

View File

@ -8,14 +8,6 @@ matrix:
# Container-based Ubuntu 12.04 LTS Server Edition 64 bit (doesn't support 32-bit includes)
- env: Ubu=12.04cont Cmd="make usan"
os: linux
sudo: false
- env: Ubu=12.04cont Cmd="make asan"
os: linux
sudo: false
- env: Ubu=12.04cont Cmd="make uasan"
os: linux
sudo: false
@ -46,17 +38,12 @@ matrix:
# Ubuntu 14.04 LTS Server Edition 64 bit
- env: Ubu=14.04 Cmd='cd contrib/pzstd && make googletest pzstd tests check && make clean
&& make googletest32 all32 check && make clean
&& make googletest tsan check && make clean
&& make asan check && make clean'
- env: Ubu=14.04 Cmd='cd contrib/pzstd && make test-pzstd && make test-pzstd32 && make test-pzstd-tsan && test-pzstd-asan'
os: linux
dist: trusty
sudo: required
install:
- export CXX="g++-6" CC="gcc-6"
- export LDFLAGS="-fuse-ld=gold"
- export TESTFLAGS='--gtest_filter=-*ExtremelyLarge*'
addons:
apt:
sources:

View File

@ -85,6 +85,23 @@ endif
.PHONY: default
default: all
.PHONY: test-pzstd
test-pzstd: TESTFLAGS='--gtest_filter=-*ExtremelyLarge*'
test-pzstd: clean googletest pzstd tests check
.PHONY: test-pzstd32
test-pzstd32: clean googletest32 all32 check
.PHONY: test-pzstd-tsan
test-pzstd-tsan: LDFLAGS="-fuse-ld=gold"
test-pzstd-tsan: TESTFLAGS='--gtest_filter=-*ExtremelyLarge*'
test-pzstd-tsan: clean googletest tsan check
.PHONY: test-pzstd-asan
test-pzstd-asan: LDFLAGS="-fuse-ld=gold"
test-pzstd-asan: TESTFLAGS='--gtest_filter=-*ExtremelyLarge*'
test-pzstd-asan: clean asan check
.PHONY: check
check:
$(TESTPROG) ./utils/test/BufferTest$(EXT) $(TESTFLAGS)

View File

@ -399,7 +399,7 @@ int main(int argCount, const char* argv[])
while (argument[0]!=0) {
if (lastCommand) {
DISPLAY("error : command must be followed by argument \n");
return 1;
CLEAN_RETURN(1);
}
#ifndef ZSTD_NOCOMPRESS
/* compression Level */
@ -555,7 +555,7 @@ int main(int argCount, const char* argv[])
filenameTable[filenameIdx++] = argument;
}
if (lastCommand) { DISPLAY("error : command must be followed by argument \n"); return 1; } /* forgotten argument */
if (lastCommand) { DISPLAY("error : command must be followed by argument \n"); CLEAN_RETURN(1); } /* forgotten argument */
/* Welcome message (if verbose) */
DISPLAYLEVEL(3, WELCOME_MESSAGE);

View File

@ -496,6 +496,8 @@ static int basicUnitTests(U32 seed, double compressibility, ZSTD_customMem custo
/* Bug will cause checksum to fail */
if (ZSTD_isError(r)) goto _output_error;
}
ZSTD_freeDStream(zds);
}
DISPLAYLEVEL(3, "OK \n");