]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Only the CCtx Itself Needs to be Cleared during Static CCtx Init
authorW. Felix Handte <w@felixhandte.com>
Wed, 14 Aug 2019 15:35:53 +0000 (11:35 -0400)
committerW. Felix Handte <w@felixhandte.com>
Mon, 9 Sep 2019 17:34:08 +0000 (13:34 -0400)
lib/compress/zstd_compress.c

index 78a5794500c01f1399f4f08878f4c472b2fe0822..a8bf0d927d129c17bfe9dcf70dafb146dff5fd2f 100644 (file)
@@ -281,7 +281,7 @@ ZSTD_CCtx* ZSTD_initStaticCCtx(void *workspace, size_t workspaceSize)
     ZSTD_CCtx* const cctx = (ZSTD_CCtx*) workspace;
     if (workspaceSize <= sizeof(ZSTD_CCtx)) return NULL;  /* minimum size */
     if ((size_t)workspace & 7) return NULL;  /* must be 8-aligned */
-    memset(workspace, 0, workspaceSize);   /* may be a bit generous, could memset be smaller ? */ /* TODO(felixh): investigate */
+    memset(cctx, 0, sizeof(ZSTD_CCtx));
     cctx->staticSize = workspaceSize;
     ZSTD_workspace_init(&cctx->workspace, (void*)(cctx+1), workspaceSize - sizeof(ZSTD_CCtx));