Cleanup locale.localeconv(): move Py_DECREF() closer to the error

This commit is contained in:
Victor Stinner 2013-10-29 19:28:20 +01:00
parent 1ce3f840be
commit f38a5c28e0

View File

@ -151,8 +151,10 @@ PyLocale_localeconv(PyObject* self)
do { \ do { \
if (obj == NULL) \ if (obj == NULL) \
goto failed; \ goto failed; \
if (PyDict_SetItemString(result, key, obj) < 0) \ if (PyDict_SetItemString(result, key, obj) < 0) { \
Py_DECREF(obj); \
goto failed; \ goto failed; \
} \
Py_DECREF(obj); \ Py_DECREF(obj); \
} while (0) } while (0)
@ -196,7 +198,6 @@ PyLocale_localeconv(PyObject* self)
failed: failed:
Py_XDECREF(result); Py_XDECREF(result);
Py_XDECREF(x);
return NULL; return NULL;
} }