]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-146244: Fix initconfig.c SET_ITEM macro leaks dict on expression failure (GH-146246)
authorWulian233 <1055917385@qq.com>
Wed, 25 Mar 2026 19:09:56 +0000 (03:09 +0800)
committerGitHub <noreply@github.com>
Wed, 25 Mar 2026 19:09:56 +0000 (19:09 +0000)
Python/initconfig.c

index caf42f5247c2f210eae27f49d23a49e38e998996..8dc9602ff13df794b14ef50fcb71f0f68428f0f8 100644 (file)
@@ -511,7 +511,7 @@ _Py_COMP_DIAG_IGNORE_DEPR_DECLS
         do { \
             obj = (EXPR); \
             if (obj == NULL) { \
-                return NULL; \
+                goto fail; \
             } \
             int res = PyDict_SetItemString(dict, (KEY), obj); \
             Py_DECREF(obj); \