summaryrefslogtreecommitdiffstats
path: root/ext/kate
diff options
context:
space:
mode:
authorogg.k.ogg.k <ogg.k.ogg.k@googlemail.com>2009-07-20 16:24:23 +0100
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2009-07-20 23:45:47 +0100
commit265b75ca38913c7a9c0281d472f93e7936b6fa91 (patch)
tree9abf75326eeba5cdd4513908b89bb5d740c4abef /ext/kate
parent8ac16a90e4d0cc05a5c1c84c0c04bded901795bb (diff)
downloadgst-plugins-bad-265b75ca38913c7a9c0281d472f93e7936b6fa91.tar.gz
gst-plugins-bad-265b75ca38913c7a9c0281d472f93e7936b6fa91.tar.bz2
gst-plugins-bad-265b75ca38913c7a9c0281d472f93e7936b6fa91.zip
kate: fix some minor memory leaks
Makes 'make check-valgrind' work for the kate unit test (#525743)
Diffstat (limited to 'ext/kate')
-rw-r--r--ext/kate/gstkatetag.c5
-rw-r--r--ext/kate/gstkateutil.c10
2 files changed, 12 insertions, 3 deletions
diff --git a/ext/kate/gstkatetag.c b/ext/kate/gstkatetag.c
index 7a39c556..f5734c12 100644
--- a/ext/kate/gstkatetag.c
+++ b/ext/kate/gstkatetag.c
@@ -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) {
diff --git a/ext/kate/gstkateutil.c b/ext/kate/gstkateutil.c
index 78f18dae..b8915d70 100644
--- a/ext/kate/gstkateutil.c
+++ b/ext/kate/gstkateutil.c
@@ -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;