From b9063640e526423bee89d03c69a37438473df7e7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Wed, 18 Oct 2006 18:40:12 +0000 Subject: [PATCH] gst/subparse/gstsubparse.c: Fix memleak; clear subparse->textbuf n state change function. Original commit message from CVS: * gst/subparse/gstsubparse.c: (gst_sub_parse_dispose), (gst_sub_parse_change_state): Fix memleak; clear subparse->textbuf n state change function. --- ChangeLog | 6 ++++++ gst/subparse/gstsubparse.c | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6f1ebd9..6d73e7c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2006-10-18 Tim-Philipp Müller + * gst/subparse/gstsubparse.c: (gst_sub_parse_dispose), + (gst_sub_parse_change_state): + Fix memleak; clear subparse->textbuf n state change function. + +2006-10-18 Tim-Philipp Müller + * gst/subparse/gstsubparse.c: (gst_sub_parse_data_format_autodetect): Don't require subrip (.srt) files to start with a chunk number of 1. diff --git a/gst/subparse/gstsubparse.c b/gst/subparse/gstsubparse.c index a073c82..26409ed 100644 --- a/gst/subparse/gstsubparse.c +++ b/gst/subparse/gstsubparse.c @@ -143,6 +143,10 @@ gst_sub_parse_dispose (GObject * object) g_free (subparse->encoding); subparse->encoding = NULL; } + if (subparse->textbuf) { + g_string_free (subparse->textbuf, TRUE); + subparse->textbuf = NULL; + } sami_context_deinit (&subparse->state); GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object)); @@ -933,9 +937,11 @@ gst_sub_parse_change_state (GstElement * element, GstStateChange transition) switch (transition) { case GST_STATE_CHANGE_READY_TO_PAUSED: /* format detection will init the parser state */ - self->offset = self->next_offset = 0; + self->offset = 0; + self->next_offset = 0; self->parser_type = GST_SUB_PARSE_FORMAT_UNKNOWN; self->valid_utf8 = TRUE; + g_string_truncate (self->textbuf, 0); break; default: break; -- 2.7.4