From: James Bowman Date: Wed, 19 Jan 2011 01:43:45 +0000 (+0000) Subject: Fixed leak of dims in MatND creates X-Git-Tag: submit/tizen/20180620.034203~3^2~7867 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8503f75212dbe4d84183e3ca2b76cc215513ad66;p=platform%2Fupstream%2Fopencv.git Fixed leak of dims in MatND creates --- diff --git a/modules/python/cv.cpp b/modules/python/cv.cpp index 61cdd54d1e..6cbe1d94d4 100644 --- a/modules/python/cv.cpp +++ b/modules/python/cv.cpp @@ -2793,6 +2793,7 @@ static PyObject *pycvCreateMatNDHeader(PyObject *self, PyObject *args) m->data = Py_None; Py_INCREF(m->data); + delete [] dims.i; return (PyObject*)m; } @@ -2806,6 +2807,7 @@ static PyObject *pycvCreateMatND(PyObject *self, PyObject *args) return NULL; cvmatnd_t *m = PyObject_NEW(cvmatnd_t, &cvmatnd_Type); ERRWRAP(m->a = cvCreateMatND(dims.count, dims.i, type)); + delete [] dims.i; return pythonize_CvMatND(m); } diff --git a/tests/python/leak2.py b/tests/python/leak2.py index 2a3d4ae212..a67352f197 100644 --- a/tests/python/leak2.py +++ b/tests/python/leak2.py @@ -6,5 +6,5 @@ while True: for i in range(4000): a = cv.CreateImage((1024,1024), cv.IPL_DEPTH_8U, 1) b = cv.CreateMat(1024, 1024, cv.CV_8UC1) - # c = cv.CreateMatND([1024,1024], cv.CV_8UC1) + c = cv.CreateMatND([1024,1024], cv.CV_8UC1) print "pause..."