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.
This commit is contained in:
Tim-Philipp Müller 2006-10-18 18:40:12 +00:00
parent aab5744b0e
commit b9063640e5
2 changed files with 13 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2006-10-18 Tim-Philipp Müller <tim at centricular dot net>
* 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 <tim at centricular dot net> 2006-10-18 Tim-Philipp Müller <tim at centricular dot net>
* gst/subparse/gstsubparse.c: * gst/subparse/gstsubparse.c:

View file

@ -143,6 +143,10 @@ gst_sub_parse_dispose (GObject * object)
g_free (subparse->encoding); g_free (subparse->encoding);
subparse->encoding = NULL; subparse->encoding = NULL;
} }
if (subparse->textbuf) {
g_string_free (subparse->textbuf, TRUE);
subparse->textbuf = NULL;
}
sami_context_deinit (&subparse->state); sami_context_deinit (&subparse->state);
GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object)); GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
@ -933,9 +937,11 @@ gst_sub_parse_change_state (GstElement * element, GstStateChange transition)
switch (transition) { switch (transition) {
case GST_STATE_CHANGE_READY_TO_PAUSED: case GST_STATE_CHANGE_READY_TO_PAUSED:
/* format detection will init the parser state */ /* 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->parser_type = GST_SUB_PARSE_FORMAT_UNKNOWN;
self->valid_utf8 = TRUE; self->valid_utf8 = TRUE;
g_string_truncate (self->textbuf, 0);
break; break;
default: default:
break; break;