mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 07:47:17 +00:00
subparse: don't leak parse context for sami and qttext
In gst_sub_parse_dispose() parser_type will be UNKNOWN, so these deinit calls were never executed. And we should clean up the parser state in the downwards state change anyway.
This commit is contained in:
parent
6cea51c962
commit
3eea81e4a2
2 changed files with 8 additions and 14 deletions
|
@ -93,17 +93,6 @@ gst_sub_parse_dispose (GObject * object)
|
|||
|
||||
GST_DEBUG_OBJECT (subparse, "cleaning up subtitle parser");
|
||||
|
||||
switch (subparse->parser_type) {
|
||||
case GST_SUB_PARSE_FORMAT_QTTEXT:
|
||||
qttext_context_deinit (&subparse->state);
|
||||
break;
|
||||
case GST_SUB_PARSE_FORMAT_SAMI:
|
||||
sami_context_deinit (&subparse->state);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (subparse->encoding) {
|
||||
g_free (subparse->encoding);
|
||||
subparse->encoding = NULL;
|
||||
|
@ -1161,8 +1150,11 @@ parser_state_dispose (GstSubParse * self, ParserState * state)
|
|||
}
|
||||
if (state->user_data) {
|
||||
switch (self->parser_type) {
|
||||
case GST_SUB_PARSE_FORMAT_QTTEXT:
|
||||
qttext_context_deinit (state);
|
||||
break;
|
||||
case GST_SUB_PARSE_FORMAT_SAMI:
|
||||
sami_context_reset (state);
|
||||
sami_context_deinit (state);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -825,14 +825,16 @@ sami_context_init (ParserState * state)
|
|||
GstSamiContext *context;
|
||||
|
||||
g_assert (state->user_data == NULL);
|
||||
state->user_data = (gpointer) g_new0 (GstSamiContext, 1);
|
||||
context = (GstSamiContext *) state->user_data;
|
||||
|
||||
context = g_new0 (GstSamiContext, 1);
|
||||
|
||||
context->htmlctxt = html_context_new (&samiParser, context);
|
||||
context->buf = g_string_new ("");
|
||||
context->rubybuf = g_string_new ("");
|
||||
context->resultbuf = g_string_new ("");
|
||||
context->state = g_string_new ("");
|
||||
|
||||
state->user_data = context;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue