diff options
author | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2009-07-19 23:16:07 +0100 |
---|---|---|
committer | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2009-07-19 23:16:07 +0100 |
commit | 3f347c7edd0796fb033bb58f15017f1f6c6c5ebe (patch) | |
tree | 7026ebf8097499c8b6a9ecf4a36f38be6c206750 | |
parent | 71efbb1e73a557d50093ccaf2ecc47009b7edd95 (diff) | |
download | gst-plugins-bad-3f347c7edd0796fb033bb58f15017f1f6c6c5ebe.tar.gz gst-plugins-bad-3f347c7edd0796fb033bb58f15017f1f6c6c5ebe.tar.bz2 gst-plugins-bad-3f347c7edd0796fb033bb58f15017f1f6c6c5ebe.zip |
kate: make sure to free some more stuff
-rw-r--r-- | ext/kate/gstkateparse.c | 14 | ||||
-rw-r--r-- | ext/kate/gstkateutil.c | 19 |
2 files changed, 33 insertions, 0 deletions
diff --git a/ext/kate/gstkateparse.c b/ext/kate/gstkateparse.c index 5cf8ec48..eb0d2b08 100644 --- a/ext/kate/gstkateparse.c +++ b/ext/kate/gstkateparse.c @@ -193,6 +193,7 @@ gst_kate_parse_push_headers (GstKateParse * parse) if (G_UNLIKELY (ret < 0)) { GST_WARNING_OBJECT (parse, "kate_decode_headerin returned %d", ret); } + /* takes ownership of outbuf, which was previously in parse->streamheader */ outbuf_list = g_list_append (outbuf_list, outbuf); headers = headers->next; } @@ -210,6 +211,8 @@ gst_kate_parse_push_headers (GstKateParse * parse) } g_list_free (outbuf_list); + g_list_free (parse->streamheader); + parse->streamheader = NULL; parse->streamheader_sent = TRUE; @@ -575,6 +578,16 @@ error: #endif } +static void +gst_kate_parse_free_stream_headers (GstKateParse * parse) +{ + while (parse->streamheader != NULL) { + gst_buffer_unref (GST_BUFFER (parse->streamheader->data)); + parse->streamheader = g_list_delete_link (parse->streamheader, + parse->streamheader); + } +} + static GstStateChangeReturn gst_kate_parse_change_state (GstElement * element, GstStateChange transition) { @@ -607,6 +620,7 @@ gst_kate_parse_change_state (GstElement * element, GstStateChange transition) parse->buffer_queue = NULL; g_queue_free (parse->event_queue); parse->event_queue = NULL; + gst_kate_parse_free_stream_headers (parse); break; default: diff --git a/ext/kate/gstkateutil.c b/ext/kate/gstkateutil.c index f47ba575..e25321b0 100644 --- a/ext/kate/gstkateutil.c +++ b/ext/kate/gstkateutil.c @@ -25,6 +25,7 @@ #include "gstkate.h" #include "gstkateutil.h" +/* FIXME: shouldn't all this GstKateDecoderBase stuff really be a base class? */ GstCaps * gst_kate_util_set_header_on_caps (GstElement * element, GstCaps * caps, @@ -107,6 +108,22 @@ gst_kate_util_decode_base_init (GstKateDecoderBase * decoder) decoder->initialized = FALSE; } +static void +gst_kate_util_decode_base_reset (GstKateDecoderBase * decoder) +{ + g_free (decoder->language); + decoder->language = NULL; + g_free (decoder->category); + decoder->category = NULL; + if (decoder->tags) { + gst_tag_list_free (decoder->tags); + decoder->tags = NULL; + } + decoder->original_canvas_width = 0; + decoder->original_canvas_height = 0; + decoder->initialized = FALSE; +} + gboolean gst_kate_util_decoder_base_get_property (GstKateDecoderBase * decoder, GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) @@ -274,8 +291,10 @@ gst_kate_decoder_base_change_state (GstKateDecoderBase * decoder, kate_high_decode_clear (&decoder->k); decoder->initialized = FALSE; } + gst_kate_util_decode_base_reset (decoder); break; case GST_STATE_CHANGE_READY_TO_NULL: + gst_kate_util_decode_base_reset (decoder); break; default: break; |