diff options
author | Julian Taylor <jtaylor.debian@googlemail.com> | 2014-03-11 21:39:54 +0100 |
---|---|---|
committer | Julian Taylor <jtaylor.debian@googlemail.com> | 2014-03-23 22:49:11 +0100 |
commit | c0f0f106bb08b213c38bab77916d4af0ab680529 (patch) | |
tree | 072c8e72d9c1bd6ecbacfa8b4aac0bf0498a7918 | |
parent | 3aa88afe8d6b974eee17c2b72fe767d04c24b928 (diff) | |
download | numpy-c0f0f106bb08b213c38bab77916d4af0ab680529.tar.gz |
BUG: add missing gufunc failure return values and missing malloc fail check
-rw-r--r-- | numpy/core/src/umath/ufunc_object.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c index 6fe08dfe7..fd8161b4c 100644 --- a/numpy/core/src/umath/ufunc_object.c +++ b/numpy/core/src/umath/ufunc_object.c @@ -2090,6 +2090,11 @@ PyUFunc_GeneralizedFunction(PyUFuncObject *ufunc, */ inner_strides = (npy_intp *)PyArray_malloc( NPY_SIZEOF_INTP * (nop+core_dim_ixs_size)); + if (inner_strides == NULL) { + PyErr_NoMemory(); + retval = -1; + goto fail; + } /* Copy the strides after the first nop */ idim = nop; for (i = 0; i < nop; ++i) { @@ -2196,11 +2201,13 @@ PyUFunc_GeneralizedFunction(PyUFuncObject *ufunc, PyErr_Format(PyExc_ValueError, "ufunc %s ", ufunc_name); + retval = -1; goto fail; default: PyErr_Format(PyExc_ValueError, "ufunc %s has an invalid identity for reduction", ufunc_name); + retval = -1; goto fail; } } |