summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2009-06-23 12:40:56 +0200
committerWim Taymans <wim.taymans@collabora.co.uk>2009-06-23 12:40:56 +0200
commitc933933f09c8977fc88449d14f14f4b733cf3274 (patch)
tree76a276dd66220141d67d1b08fbc325a2764eb551
parent6688af35eb4206680a52e7542bf177df665b51f4 (diff)
ssaparse: avoid leaking all buffers
-rw-r--r--gst/subparse/gstssaparse.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/gst/subparse/gstssaparse.c b/gst/subparse/gstssaparse.c
index 0d8010ad1..622671c48 100644
--- a/gst/subparse/gstssaparse.c
+++ b/gst/subparse/gstssaparse.c
@@ -318,9 +318,8 @@ gst_ssa_parse_chain (GstPad * sinkpad, GstBuffer * buf)
/* make double-sure it's 0-terminated and all */
txt = g_strndup ((gchar *) GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
-
if (txt == NULL)
- return GST_FLOW_UNEXPECTED;
+ goto empty_text;
ts = GST_BUFFER_TIMESTAMP (buf);
ret = gst_ssa_parse_push_line (parse, txt, ts, GST_BUFFER_DURATION (buf));
@@ -332,6 +331,7 @@ gst_ssa_parse_chain (GstPad * sinkpad, GstBuffer * buf)
ret = GST_FLOW_OK;
}
+ gst_buffer_unref (buf);
g_free (txt);
return ret;
@@ -341,8 +341,16 @@ not_framed:
{
GST_ELEMENT_ERROR (parse, STREAM, FORMAT, (NULL),
("Only SSA subtitles embedded in containers are supported"));
+ gst_buffer_unref (buf);
return GST_FLOW_NOT_NEGOTIATED;
}
+empty_text:
+ {
+ GST_ELEMENT_WARNING (parse, STREAM, FORMAT, (NULL),
+ ("Received empty subtitle"));
+ gst_buffer_unref (buf);
+ return GST_FLOW_OK;
+ }
}
static GstStateChangeReturn