]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-132983: Fix refleak in zstd dictionary functions (gh-134459)
authorEmma Smith <emma@emmatyping.dev>
Wed, 21 May 2025 19:09:34 +0000 (15:09 -0400)
committerGitHub <noreply@github.com>
Wed, 21 May 2025 19:09:34 +0000 (19:09 +0000)
Modules/_zstd/_zstdmodule.c

index b2e4f95b90635611f433852ce796746374e8d79c..17d3bff1e98769f31e479b2d5c4f839ec2191803 100644 (file)
@@ -251,7 +251,7 @@ _zstd_train_dict_impl(PyObject *module, PyBytesObject *samples_bytes,
                                             &chunk_sizes);
     if (chunks_number < 0)
     {
-        return NULL;
+        goto error;
     }
 
     /* Allocate dict buffer */
@@ -333,7 +333,7 @@ _zstd_finalize_dict_impl(PyObject *module, PyBytesObject *custom_dict_bytes,
                                             &chunk_sizes);
     if (chunks_number < 0)
     {
-        return NULL;
+        goto error;
     }
 
     /* Allocate dict buffer */