basetextoverlay: fix buffer leak in chain function

If we don't consume the buffer by passing its reference to
overlay->text_buffer then we need to unref it.

Fix a leak with validate.file.playback.fast_forward.test5_mkv
when running inside Valgrind.

https://bugzilla.gnome.org/show_bug.cgi?id=747602
This commit is contained in:
Guillaume Desmottes 2015-04-09 17:03:11 +02:00 committed by Tim-Philipp Müller
parent d668b511d1
commit e9a6cafa13

View file

@ -2273,7 +2273,9 @@ gst_base_text_overlay_text_chain (GstPad * pad, GstObject * parent,
if (GST_BUFFER_TIMESTAMP_IS_VALID (buffer))
overlay->text_segment.position = clip_start;
overlay->text_buffer = buffer;
overlay->text_buffer = buffer; /* pass ownership of @buffer */
buffer = NULL;
/* That's a new text buffer we need to render */
overlay->need_render = TRUE;
@ -2284,6 +2286,8 @@ gst_base_text_overlay_text_chain (GstPad * pad, GstObject * parent,
GST_BASE_TEXT_OVERLAY_UNLOCK (overlay);
beach:
if (buffer)
gst_buffer_unref (buffer);
return ret;
}