提交 70965d0d authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Added free(newdims) when exiting before the end of the function.

上级 6b25596e
...@@ -345,6 +345,7 @@ PyObject* CudaNdarray_Zeros(PyObject* dummy, PyObject* shape) ...@@ -345,6 +345,7 @@ PyObject* CudaNdarray_Zeros(PyObject* dummy, PyObject* shape)
{ {
// shouldn't happen since we checked length before... // shouldn't happen since we checked length before...
PyErr_SetString(PyExc_RuntimeError, "CudaNdarray_Zeros: Index out of bound in sequence"); PyErr_SetString(PyExc_RuntimeError, "CudaNdarray_Zeros: Index out of bound in sequence");
free(newdims);
return NULL; return NULL;
} }
...@@ -354,6 +355,7 @@ PyObject* CudaNdarray_Zeros(PyObject* dummy, PyObject* shape) ...@@ -354,6 +355,7 @@ PyObject* CudaNdarray_Zeros(PyObject* dummy, PyObject* shape)
if (shp_el <= 0) if (shp_el <= 0)
{ {
PyErr_SetString(PyExc_ValueError, "CudaNdarray_Zeros: shape must not contain 0 (or negative value) for size of a dimension"); PyErr_SetString(PyExc_ValueError, "CudaNdarray_Zeros: shape must not contain 0 (or negative value) for size of a dimension");
free(newdims);
return NULL; return NULL;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论