]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Avoid ASAN Failure in ZSTD_cwksp_free()
authorW. Felix Handte <w@felixhandte.com>
Mon, 16 Sep 2019 21:43:55 +0000 (17:43 -0400)
committerW. Felix Handte <w@felixhandte.com>
Thu, 10 Oct 2019 17:40:16 +0000 (13:40 -0400)
lib/compress/zstd_cwksp.h

index f6068127b78bd77a264e6d8571604808364977c6..bae5b654d51e92747f2c2d56dd225832a74bd0cf 100644 (file)
@@ -478,9 +478,10 @@ MEM_STATIC size_t ZSTD_cwksp_create(ZSTD_cwksp* ws, size_t size, ZSTD_customMem
 }
 
 MEM_STATIC void ZSTD_cwksp_free(ZSTD_cwksp* ws, ZSTD_customMem customMem) {
+    void *ptr = ws->workspace;
     DEBUGLOG(4, "cwksp: freeing workspace");
-    ZSTD_free(ws->workspace, customMem);
     memset(ws, 0, sizeof(ZSTD_cwksp));
+    ZSTD_free(ptr, customMem);
 }
 
 /**