memory leak in loop
I'm using a simple for loop to do X itterations of the same filter:
void filterwrapper(IplImage *src, IplImage **dst, int filter_sel, int param1, int param2, int iterations) { int i; *dst = cvCloneImage(src); . . . for (i = 0; i < iterations; i++) { cvSmooth( *dst, *dst, CV_MEDIAN, param1, 0); } }
I'm aware i somehow have to release the memory using cvReleasimg(), but doing so inside the loop causes my program to crash. I've tried using a temporary image (IplImage *tmp) as a placeholder and releasing this each loop, but i still get an memory allocation error when running the program.
Your code is correct elsewhere there is an error.
thx for your repply. switcing from cvCloneImage to cvCopy cleared the issue