fix memory leaks
diff --git a/.travis.yml b/.travis.yml
index 7379fc5..38ed234 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,14 +8,6 @@
 
 
     # 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 @@
 
 
     # 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:
diff --git a/contrib/pzstd/Makefile b/contrib/pzstd/Makefile
index f148bfd..10a133d 100644
--- a/contrib/pzstd/Makefile
+++ b/contrib/pzstd/Makefile
@@ -85,6 +85,23 @@
 .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)
diff --git a/programs/zstdcli.c b/programs/zstdcli.c
index 5881119..a7b4fdd 100644
--- a/programs/zstdcli.c
+++ b/programs/zstdcli.c
@@ -399,7 +399,7 @@
                 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 @@
         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);
diff --git a/tests/zstreamtest.c b/tests/zstreamtest.c
index 9a9fed9..c22a284 100644
--- a/tests/zstreamtest.c
+++ b/tests/zstreamtest.c
@@ -496,6 +496,8 @@
             /* Bug will cause checksum to fail */
             if (ZSTD_isError(r)) goto _output_error;
         }
+
+        ZSTD_freeDStream(zds);
     }
     DISPLAYLEVEL(3, "OK \n");