]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fix memory leaks
authorPrzemyslaw Skibinski <inikep@gmail.com>
Tue, 21 Feb 2017 17:17:24 +0000 (18:17 +0100)
committerPrzemyslaw Skibinski <inikep@gmail.com>
Tue, 21 Feb 2017 17:17:24 +0000 (18:17 +0100)
.travis.yml
contrib/pzstd/Makefile
programs/zstdcli.c
tests/zstreamtest.c

index 7379fc50408a53f8dfb3e7ca96be706b3c0c9628..38ed234314b00e8d6758fad0855f8746e593feaa 100644 (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:
index f148bfd8e2273fc9dc823823872675e8e9fb5d31..10a133dd75dd27d600567e3cedc35fa6660fd773 100644 (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)
index 588111913d3bcaecc2782b391d9c223dda1c0a51..a7b4fddc81f2ea205cec04245ec1411cebdf824e 100644 (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);
index 9a9fed98deb025beb909652e8db145ab2c950ee7..c22a284c7eb038809629a5a0a17bbe04d5f54f0c 100644 (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");