summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/core/src/umath/ufunc_object.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c
index 1b47e74ac..60a315f6e 100644
--- a/numpy/core/src/umath/ufunc_object.c
+++ b/numpy/core/src/umath/ufunc_object.c
@@ -5228,6 +5228,7 @@ PyUFunc_RegisterLoopForDescr(PyUFuncObject *ufunc,
arg_typenums = PyArray_malloc(ufunc->nargs * sizeof(int));
if (arg_typenums == NULL) {
+ Py_DECREF(key);
PyErr_NoMemory();
return -1;
}
@@ -5365,6 +5366,7 @@ PyUFunc_RegisterLoopForType(PyUFuncObject *ufunc,
/* Get entry for this user-defined type*/
cobj = PyDict_GetItemWithError(ufunc->userloops, key);
if (cobj == NULL && PyErr_Occurred()) {
+ Py_DECREF(key);
return 0;
}
/* If it's not there, then make one and return. */