edgedetect: Don't leak cvImages when caps are changing or the element is reused

This commit is contained in:
Sebastian Dröge 2014-06-30 00:05:53 +02:00
parent 45ac4ba663
commit 48e95f3d6f

View file

@ -270,6 +270,13 @@ gst_edge_detect_handle_sink_event (GstPad * pad, GstObject * parent,
gst_structure_get_int (structure, "width", &width);
gst_structure_get_int (structure, "height", &height);
if (filter->cvImage != NULL) {
cvReleaseImage (&filter->cvImage);
cvReleaseImage (&filter->cvCEdge);
cvReleaseImage (&filter->cvGray);
cvReleaseImage (&filter->cvEdge);
}
filter->cvImage = cvCreateImage (cvSize (width, height), IPL_DEPTH_8U, 3);
filter->cvCEdge = cvCreateImage (cvSize (width, height), IPL_DEPTH_8U, 3);
filter->cvGray = cvCreateImage (cvSize (width, height), IPL_DEPTH_8U, 1);