From 0272316aa55bef9da9d21a8ad590432385bc81e3 Mon Sep 17 00:00:00 2001 From: Hugo Defois Date: Mon, 5 Jul 2021 16:18:34 +0200 Subject: BUG: fix a leak in ufunc_object.PyUFunc_RegisterLoopForType --- numpy/core/src/umath/ufunc_object.c | 1 + 1 file changed, 1 insertion(+) diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c index 067de6990..eceb18994 100644 --- a/numpy/core/src/umath/ufunc_object.c +++ b/numpy/core/src/umath/ufunc_object.c @@ -5355,6 +5355,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. */ -- cgit v1.2.1 From 4b971415cd44ab42f4853c3cd5639ff14a9c329d Mon Sep 17 00:00:00 2001 From: Hugo Defois Date: Mon, 5 Jul 2021 16:37:11 +0200 Subject: BUG: fix a leak in ufunc_object.PyUFunc_RegisterLoopForDescr --- numpy/core/src/umath/ufunc_object.c | 1 + 1 file changed, 1 insertion(+) diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c index eceb18994..27d21121f 100644 --- a/numpy/core/src/umath/ufunc_object.c +++ b/numpy/core/src/umath/ufunc_object.c @@ -5218,6 +5218,7 @@ PyUFunc_RegisterLoopForDescr(PyUFuncObject *ufunc, arg_typenums = PyArray_malloc(ufunc->nargs * sizeof(int)); if (arg_typenums == NULL) { + Py_DECREF(key); PyErr_NoMemory(); return -1; } -- cgit v1.2.1