diff options
author | Pauli Virtanen <pav@iki.fi> | 2017-02-06 21:51:46 +0100 |
---|---|---|
committer | Pauli Virtanen <pav@iki.fi> | 2017-02-06 21:55:26 +0100 |
commit | da4be54bc73f805fa94cc2cd770fecb095c5dac6 (patch) | |
tree | 98d8ca5c5bcc37ff0b0d0cfe34682235d39906c2 | |
parent | e09bd51c070539f2e955fb474ee092c7eda74c98 (diff) | |
download | numpy-da4be54bc73f805fa94cc2cd770fecb095c5dac6.tar.gz |
BUG: core: fix refcount errors on error handling
-rw-r--r-- | numpy/core/src/multiarray/mapping.c | 1 | ||||
-rw-r--r-- | numpy/core/src/umath/reduction.c | 1 | ||||
-rw-r--r-- | numpy/core/src/umath/ufunc_object.c | 1 |
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; } |