diff --git a/Modules/Bridge/NumPy/include/itkPyBuffer.hxx b/Modules/Bridge/NumPy/include/itkPyBuffer.hxx index 1718e2c74b7..0252850b214 100644 --- a/Modules/Bridge/NumPy/include/itkPyBuffer.hxx +++ b/Modules/Bridge/NumPy/include/itkPyBuffer.hxx @@ -78,7 +78,6 @@ PyBuffer::_GetImageViewFromArray(PyObject * arr, PyObject * shape, PyObj if (PyObject_GetBuffer(arr, &pyBuffer, PyBUF_ND | PyBUF_ANY_CONTIGUOUS) == -1) { PyErr_SetString(PyExc_RuntimeError, "Cannot get an instance of NumPy array."); - PyBuffer_Release(&pyBuffer); return nullptr; } diff --git a/Modules/Bridge/NumPy/include/itkPyVectorContainer.hxx b/Modules/Bridge/NumPy/include/itkPyVectorContainer.hxx index c0a02d021b4..5916ea1c973 100644 --- a/Modules/Bridge/NumPy/include/itkPyVectorContainer.hxx +++ b/Modules/Bridge/NumPy/include/itkPyVectorContainer.hxx @@ -58,7 +58,6 @@ PyVectorContainer::_vector_container_from_array(Py if (PyObject_GetBuffer(arr, &pyBuffer, PyBUF_CONTIG) == -1) { PyErr_SetString(PyExc_RuntimeError, "Cannot get an instance of NumPy array."); - PyBuffer_Release(&pyBuffer); return nullptr; } diff --git a/Modules/Bridge/NumPy/include/itkPyVnl.hxx b/Modules/Bridge/NumPy/include/itkPyVnl.hxx index 3accb0c62c3..23749902aa3 100644 --- a/Modules/Bridge/NumPy/include/itkPyVnl.hxx +++ b/Modules/Bridge/NumPy/include/itkPyVnl.hxx @@ -57,7 +57,6 @@ PyVnl::_GetVnlVectorFromArray(PyObject * arr, PyObject * shape) -> con if (PyObject_GetBuffer(arr, &pyBuffer, PyBUF_CONTIG) == -1) { PyErr_SetString(PyExc_RuntimeError, "Cannot get an instance of NumPy array."); - PyBuffer_Release(&pyBuffer); return VectorType(); } @@ -125,7 +124,6 @@ PyVnl::_GetVnlMatrixFromArray(PyObject * arr, PyObject * shape) -> con if (PyObject_GetBuffer(arr, &pyBuffer, PyBUF_CONTIG) == -1) { PyErr_SetString(PyExc_RuntimeError, "Cannot get an instance of NumPy array."); - PyBuffer_Release(&pyBuffer); return MatrixType(); }