kate: make sure to free some more stuff

This commit is contained in:
Tim-Philipp Müller 2009-07-19 23:16:07 +01:00
parent 71efbb1e73
commit 3f347c7edd
2 changed files with 33 additions and 0 deletions

View file

@ -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:

View file

@ -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;