summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/src/multiarray/mapping.c1
-rw-r--r--numpy/core/src/umath/reduction.c1
-rw-r--r--numpy/core/src/umath/ufunc_object.c1
3 files changed, 2 insertions, 1 deletions
diff --git a/numpy/core/src/multiarray/mapping.c b/numpy/core/src/multiarray/mapping.c
index a6d1527d8..28c790ae2 100644
--- a/numpy/core/src/multiarray/mapping.c
+++ b/numpy/core/src/multiarray/mapping.c
@@ -3205,7 +3205,6 @@ PyArray_MapIterArrayCopyIfOverlap(PyArrayObject * a, PyObject * index,
Py_INCREF(a);
if (PyArray_SetUpdateIfCopyBase(a_copy, a) < 0) {
- Py_DECREF(a);
goto fail;
}
diff --git a/numpy/core/src/umath/reduction.c b/numpy/core/src/umath/reduction.c
index c7bca1932..47598bed9 100644
--- a/numpy/core/src/umath/reduction.c
+++ b/numpy/core/src/umath/reduction.c
@@ -189,6 +189,7 @@ conform_reduce_result(int ndim, npy_bool *axis_flags,
Py_INCREF(ret);
if (PyArray_SetUpdateIfCopyBase(ret_copy, (PyArrayObject *)ret) < 0) {
Py_DECREF(ret);
+ Py_DECREF(ret_copy);
return NULL;
}
diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c
index 91bb44435..a07b2514e 100644
--- a/numpy/core/src/umath/ufunc_object.c
+++ b/numpy/core/src/umath/ufunc_object.c
@@ -1484,6 +1484,7 @@ iterator_loop(PyUFuncObject *ufunc,
/* Call the __array_prepare__ functions for the new array */
if (prepare_ufunc_output(ufunc, &op[nin+i],
arr_prep[i], arr_prep_args, i) < 0) {
+ NpyIter_Deallocate(iter);
return -1;
}