summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorDavid Cournapeau <cournape@gmail.com>2009-07-21 05:33:55 +0000
committerDavid Cournapeau <cournape@gmail.com>2009-07-21 05:33:55 +0000
commit93e04299cbcba04d31a23cba21c349d350dc075b (patch)
tree3e338b1f46269e5342b80b7196078347cc381668 /numpy
parent3cccb41acc5046eb448a5af16fb9e7b7a2a98c9c (diff)
downloadnumpy-93e04299cbcba04d31a23cba21c349d350dc075b.tar.gz
Fix deallocation of iter->constant for padding modes which set it to NULL.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/src/multiarray/iterators.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/numpy/core/src/multiarray/iterators.c b/numpy/core/src/multiarray/iterators.c
index 17c47a353..455ce06ad 100644
--- a/numpy/core/src/multiarray/iterators.c
+++ b/numpy/core/src/multiarray/iterators.c
@@ -1827,6 +1827,10 @@ PyArray_NeighborhoodIterNew(PyArrayIterObject *x, intp *bounds,
}
ret->mode = mode->mode;
break;
+ case NPY_NEIGHBORHOOD_ITER_MIRROR_PADDING:
+ ret->mode = mode->mode;
+ ret->constant = NULL;
+ break;
default:
PyErr_SetString(PyExc_ValueError, "Unsupported padding mode");
goto clean_x;
@@ -1857,7 +1861,9 @@ static void neighiter_dealloc(PyArrayNeighborhoodIterObject* iter)
Py_DECREF(*(PyObject**)iter->constant);
}
}
- PyDataMem_FREE(iter->constant);
+ if (iter->constant != NULL) {
+ PyDataMem_FREE(iter->constant);
+ }
Py_DECREF(iter->_internal_iter);
array_iter_base_dealloc((PyArrayIterObject*)iter);