]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
zstd_compress.c: fix memory leaks
authorPrzemyslaw Skibinski <inikep@gmail.com>
Tue, 21 Feb 2017 17:59:56 +0000 (18:59 +0100)
committerPrzemyslaw Skibinski <inikep@gmail.com>
Tue, 21 Feb 2017 17:59:56 +0000 (18:59 +0100)
contrib/pzstd/Makefile
lib/compress/zstd_compress.c

index 10a133dd75dd27d600567e3cedc35fa6660fd773..21ef935c600447a514a1d2ea5a81a3223adc881d 100644 (file)
@@ -86,20 +86,20 @@ endif
 default: all
 
 .PHONY: test-pzstd
-test-pzstd: TESTFLAGS='--gtest_filter=-*ExtremelyLarge*'
+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: 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: LDFLAGS=-fuse-ld=gold
+test-pzstd-asan: TESTFLAGS=--gtest_filter=-*ExtremelyLarge*
 test-pzstd-asan: clean asan check
 
 .PHONY: check
index 924189b0cddb987ffacea9bd3f262cdcec0a843e..0e0f9d37373ed3ec1883f8ba1f1ddeb468ee765b 100644 (file)
@@ -2786,7 +2786,7 @@ ZSTD_CDict* ZSTD_createCDict_advanced(const void* dictBuffer, size_t dictSize, u
 
         if (!cdict || !cctx) {
             ZSTD_free(cdict, customMem);
-            ZSTD_free(cctx, customMem);
+            ZSTD_freeCCtx(cctx);
             return NULL;
         }
 
@@ -2804,8 +2804,8 @@ ZSTD_CDict* ZSTD_createCDict_advanced(const void* dictBuffer, size_t dictSize, u
         {   size_t const errorCode = ZSTD_compressBegin_advanced(cctx, cdict->dictContent, dictSize, params, 0);
             if (ZSTD_isError(errorCode)) {
                 ZSTD_free(cdict->dictBuffer, customMem);
-                ZSTD_free(cctx, customMem);
                 ZSTD_free(cdict, customMem);
+                ZSTD_freeCCtx(cctx);
                 return NULL;
         }   }