diff options
author | Travis Oliphant <oliphant@enthought.com> | 2007-10-29 01:07:46 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2007-10-29 01:07:46 +0000 |
commit | 86a257e385afd6914411215d1ff3feb9805b0ac2 (patch) | |
tree | c787f5a4cfa4c2c88b4083c7051835dac375cfa0 /numpy/core/src | |
parent | 1f0d060bdf6a5cd18d6f301c22cff0f0d482eed4 (diff) | |
download | numpy-86a257e385afd6914411215d1ff3feb9805b0ac2.tar.gz |
Fix memory leak in seterr exposed during str(a). Fixes #602
Diffstat (limited to 'numpy/core/src')
-rw-r--r-- | numpy/core/src/ufuncobject.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/numpy/core/src/ufuncobject.c b/numpy/core/src/ufuncobject.c index da0c31e36..088f1029d 100644 --- a/numpy/core/src/ufuncobject.c +++ b/numpy/core/src/ufuncobject.c @@ -3197,7 +3197,7 @@ ufunc_geterr(PyObject *dummy, PyObject *args) static int ufunc_update_use_defaults(void) { - PyObject *errobj; + PyObject *errobj=NULL; int errmask, bufsize; int res; @@ -3206,7 +3206,7 @@ ufunc_update_use_defaults(void) &errobj); PyUFunc_NUM_NODEFAULTS -= 1; - if (res < 0) return -1; + if (res < 0) {Py_XDECREF(errobj); return -1;} if ((errmask != UFUNC_ERR_DEFAULT) || \ (bufsize != PyArray_BUFSIZE) || \ @@ -3216,6 +3216,7 @@ ufunc_update_use_defaults(void) else if (PyUFunc_NUM_NODEFAULTS > 0) { PyUFunc_NUM_NODEFAULTS -= 1; } + Py_XDECREF(errobj); return 0; } #endif |