diff options
author | Matti Picus <matti.picus@gmail.com> | 2021-07-06 08:38:08 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-06 08:38:08 +0300 |
commit | bdb5cc7b54d19f1f79eba1680a59f6852c6e3614 (patch) | |
tree | a02fb868fd95745138d71912849aae840d4f06de /numpy/core | |
parent | 3300c03992d963f9c571975c17ed93f17b090672 (diff) | |
parent | 4b971415cd44ab42f4853c3cd5639ff14a9c329d (diff) | |
download | numpy-bdb5cc7b54d19f1f79eba1680a59f6852c6e3614.tar.gz |
Merge pull request #19409 from defoishugo/fix_ufunc_object_leaks
BUG: fix some memory leaks in ufunc_object
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/src/umath/ufunc_object.c | 2 |
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. */ |