Cleanup locale.localeconv(): move Py_DECREF() closer to the error
diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c
index b196749..400c344 100644
--- a/Modules/_localemodule.c
+++ b/Modules/_localemodule.c
@@ -151,8 +151,10 @@
do { \
if (obj == NULL) \
goto failed; \
- if (PyDict_SetItemString(result, key, obj) < 0) \
+ if (PyDict_SetItemString(result, key, obj) < 0) { \
+ Py_DECREF(obj); \
goto failed; \
+ } \
Py_DECREF(obj); \
} while (0)
@@ -196,7 +198,6 @@
failed:
Py_XDECREF(result);
- Py_XDECREF(x);
return NULL;
}