From 8390ef2b7876b97f7e6525286e987b938ffce57a Mon Sep 17 00:00:00 2001 From: Emma Smith Date: Wed, 21 May 2025 15:09:34 -0400 Subject: [PATCH] gh-132983: Fix refleak in zstd dictionary functions (gh-134459) (cherry picked from commit fb68776591485cacd63a97a342bf294a6ae6d4e4) Co-authored-by: Emma Smith --- Modules/_zstd/_zstdmodule.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/_zstd/_zstdmodule.c b/Modules/_zstd/_zstdmodule.c index b2e4f95b906356..17d3bff1e98769 100644 --- a/Modules/_zstd/_zstdmodule.c +++ b/Modules/_zstd/_zstdmodule.c @@ -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 */