mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
kate: fix some minor memory leaks
Makes 'make check-valgrind' work for the kate unit test (#525743)
This commit is contained in:
parent
8ac16a90e4
commit
265b75ca38
4 changed files with 12 additions and 5 deletions
|
@ -294,7 +294,10 @@ gst_kate_tag_parse_packet (GstKateParse * parse, GstBuffer * buffer)
|
|||
|
||||
/* rewrite the language and category */
|
||||
if (GST_BUFFER_SIZE (buffer) >= 64 && GST_BUFFER_DATA (buffer)[0] == 0x80) {
|
||||
buffer = gst_buffer_copy (buffer);
|
||||
GstBuffer *new_buffer = gst_buffer_copy (buffer);
|
||||
|
||||
gst_buffer_unref (buffer);
|
||||
buffer = new_buffer;
|
||||
|
||||
/* language is at offset 32, 16 bytes, zero terminated */
|
||||
if (kt->language) {
|
||||
|
|
|
@ -185,7 +185,7 @@ gst_kate_util_decoder_base_chain_kate_packet (GstKateDecoderBase * decoder,
|
|||
gst_pad_set_caps (srcpad, caps);
|
||||
gst_caps_unref (caps);
|
||||
if (decoder->k.ki->language && *decoder->k.ki->language) {
|
||||
GstTagList *tags = gst_tag_list_new ();
|
||||
GstTagList *old = decoder->tags, *tags = gst_tag_list_new ();
|
||||
if (tags) {
|
||||
gst_tag_list_add (tags, GST_TAG_MERGE_APPEND, GST_TAG_LANGUAGE_CODE,
|
||||
decoder->k.ki->language, NULL);
|
||||
|
@ -193,6 +193,8 @@ gst_kate_util_decoder_base_chain_kate_packet (GstKateDecoderBase * decoder,
|
|||
decoder->tags =
|
||||
gst_tag_list_merge (decoder->tags, tags, GST_TAG_MERGE_REPLACE);
|
||||
gst_tag_list_free (tags);
|
||||
if (old)
|
||||
gst_tag_list_free (old);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -212,7 +214,8 @@ gst_kate_util_decoder_base_chain_kate_packet (GstKateDecoderBase * decoder,
|
|||
GST_INFO_OBJECT (element, "Parsed comments header");
|
||||
{
|
||||
gchar *encoder = NULL;
|
||||
GstTagList *list = gst_tag_list_from_vorbiscomment_buffer (buf,
|
||||
GstTagList *old = decoder->tags, *list =
|
||||
gst_tag_list_from_vorbiscomment_buffer (buf,
|
||||
(const guint8 *) "\201kate\0\0\0\0", 9, &encoder);
|
||||
if (list) {
|
||||
decoder->tags =
|
||||
|
@ -235,6 +238,9 @@ gst_kate_util_decoder_base_chain_kate_packet (GstKateDecoderBase * decoder,
|
|||
GST_TAG_ENCODER_VERSION, decoder->k.ki->bitstream_version_major,
|
||||
NULL);
|
||||
|
||||
if (old)
|
||||
gst_tag_list_free (old);
|
||||
|
||||
if (decoder->initialized) {
|
||||
gst_element_found_tags_for_pad (element, srcpad, decoder->tags);
|
||||
decoder->tags = NULL;
|
||||
|
|
|
@ -71,7 +71,6 @@ endif
|
|||
|
||||
|
||||
VALGRIND_TO_FIX = \
|
||||
elements/kate \
|
||||
elements/mpeg2enc \
|
||||
elements/mplex
|
||||
|
||||
|
|
|
@ -413,7 +413,6 @@ GST_START_TEST (test_kate_encode_empty)
|
|||
1 * GST_SECOND;
|
||||
GST_BUFFER_DURATION (inbuffer) = 5 * GST_SECOND;
|
||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||
gst_buffer_ref (inbuffer);
|
||||
|
||||
caps = gst_caps_from_string ("text/plain");
|
||||
fail_unless (caps != NULL);
|
||||
|
|
Loading…
Reference in a new issue