Commit 9872c194 authored by Tim-Philipp Müller's avatar Tim-Philipp Müller
Browse files

matroskademux: don't leak doctype string in error code path

CID 1212145.
parent ab465bd1
...@@ -1200,7 +1200,7 @@ gst_matroska_read_common_parse_header (GstMatroskaReadCommon * common, ...@@ -1200,7 +1200,7 @@ gst_matroska_read_common_parse_header (GstMatroskaReadCommon * common,
while (gst_ebml_read_has_remaining (ebml, 1, TRUE)) { while (gst_ebml_read_has_remaining (ebml, 1, TRUE)) {
ret = gst_ebml_peek_id (ebml, &id); ret = gst_ebml_peek_id (ebml, &id);
if (ret != GST_FLOW_OK) if (ret != GST_FLOW_OK)
return ret; goto exit_error;
switch (id) { switch (id) {
/* is our read version uptodate? */ /* is our read version uptodate? */
...@@ -1209,7 +1209,7 @@ gst_matroska_read_common_parse_header (GstMatroskaReadCommon * common, ...@@ -1209,7 +1209,7 @@ gst_matroska_read_common_parse_header (GstMatroskaReadCommon * common,
ret = gst_ebml_read_uint (ebml, &id, &num); ret = gst_ebml_read_uint (ebml, &id, &num);
if (ret != GST_FLOW_OK) if (ret != GST_FLOW_OK)
return ret; goto exit_error;
if (num != GST_EBML_VERSION) { if (num != GST_EBML_VERSION) {
GST_ERROR_OBJECT (ebml, "Unsupported EBML version %" G_GUINT64_FORMAT, GST_ERROR_OBJECT (ebml, "Unsupported EBML version %" G_GUINT64_FORMAT,
num); num);
...@@ -1226,7 +1226,7 @@ gst_matroska_read_common_parse_header (GstMatroskaReadCommon * common, ...@@ -1226,7 +1226,7 @@ gst_matroska_read_common_parse_header (GstMatroskaReadCommon * common,
ret = gst_ebml_read_uint (ebml, &id, &num); ret = gst_ebml_read_uint (ebml, &id, &num);
if (ret != GST_FLOW_OK) if (ret != GST_FLOW_OK)
return ret; goto exit_error;
if (num > sizeof (guint64)) { if (num > sizeof (guint64)) {
GST_ERROR_OBJECT (ebml, GST_ERROR_OBJECT (ebml,
"Unsupported EBML maximum size %" G_GUINT64_FORMAT, num); "Unsupported EBML maximum size %" G_GUINT64_FORMAT, num);
...@@ -1242,7 +1242,7 @@ gst_matroska_read_common_parse_header (GstMatroskaReadCommon * common, ...@@ -1242,7 +1242,7 @@ gst_matroska_read_common_parse_header (GstMatroskaReadCommon * common,
ret = gst_ebml_read_uint (ebml, &id, &num); ret = gst_ebml_read_uint (ebml, &id, &num);
if (ret != GST_FLOW_OK) if (ret != GST_FLOW_OK)
return ret; goto exit_error;
if (num > sizeof (guint32)) { if (num > sizeof (guint32)) {
GST_ERROR_OBJECT (ebml, GST_ERROR_OBJECT (ebml,
"Unsupported EBML maximum ID %" G_GUINT64_FORMAT, num); "Unsupported EBML maximum ID %" G_GUINT64_FORMAT, num);
...@@ -1257,7 +1257,7 @@ gst_matroska_read_common_parse_header (GstMatroskaReadCommon * common, ...@@ -1257,7 +1257,7 @@ gst_matroska_read_common_parse_header (GstMatroskaReadCommon * common,
ret = gst_ebml_read_ascii (ebml, &id, &text); ret = gst_ebml_read_ascii (ebml, &id, &text);
if (ret != GST_FLOW_OK) if (ret != GST_FLOW_OK)
return ret; goto exit_error;
GST_DEBUG_OBJECT (ebml, "EbmlDocType: %s", GST_STR_NULL (text)); GST_DEBUG_OBJECT (ebml, "EbmlDocType: %s", GST_STR_NULL (text));
...@@ -1272,7 +1272,7 @@ gst_matroska_read_common_parse_header (GstMatroskaReadCommon * common, ...@@ -1272,7 +1272,7 @@ gst_matroska_read_common_parse_header (GstMatroskaReadCommon * common,
ret = gst_ebml_read_uint (ebml, &id, &num); ret = gst_ebml_read_uint (ebml, &id, &num);
if (ret != GST_FLOW_OK) if (ret != GST_FLOW_OK)
return ret; goto exit_error;
version = num; version = num;
GST_DEBUG_OBJECT (ebml, "EbmlReadVersion: %" G_GUINT64_FORMAT, num); GST_DEBUG_OBJECT (ebml, "EbmlReadVersion: %" G_GUINT64_FORMAT, num);
break; break;
...@@ -1282,7 +1282,7 @@ gst_matroska_read_common_parse_header (GstMatroskaReadCommon * common, ...@@ -1282,7 +1282,7 @@ gst_matroska_read_common_parse_header (GstMatroskaReadCommon * common,
ret = gst_matroska_read_common_parse_skip (common, ebml, ret = gst_matroska_read_common_parse_skip (common, ebml,
"EBML header", id); "EBML header", id);
if (ret != GST_FLOW_OK) if (ret != GST_FLOW_OK)
return ret; goto exit_error;
break; break;
/* we ignore these two, as they don't tell us anything we care about */ /* we ignore these two, as they don't tell us anything we care about */
...@@ -1290,7 +1290,7 @@ gst_matroska_read_common_parse_header (GstMatroskaReadCommon * common, ...@@ -1290,7 +1290,7 @@ gst_matroska_read_common_parse_header (GstMatroskaReadCommon * common,
case GST_EBML_ID_DOCTYPEVERSION: case GST_EBML_ID_DOCTYPEVERSION:
ret = gst_ebml_read_skip (ebml); ret = gst_ebml_read_skip (ebml);
if (ret != GST_FLOW_OK) if (ret != GST_FLOW_OK)
return ret; goto exit_error;
break; break;
} }
} }
...@@ -1316,14 +1316,16 @@ exit: ...@@ -1316,14 +1316,16 @@ exit:
GST_STR_NULL (doctype), version)); GST_STR_NULL (doctype), version));
ret = GST_FLOW_ERROR; ret = GST_FLOW_ERROR;
} }
g_free (doctype);
} else { } else {
GST_ELEMENT_ERROR (common, STREAM, WRONG_TYPE, (NULL), GST_ELEMENT_ERROR (common, STREAM, WRONG_TYPE, (NULL),
("Input is not a matroska stream (doctype=%s)", doctype)); ("Input is not a matroska stream (doctype=%s)", doctype));
ret = GST_FLOW_ERROR; ret = GST_FLOW_ERROR;
g_free (doctype);
} }
exit_error:
g_free (doctype);
return ret; return ret;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment