From 932b32bb6e803b4d4dca2d21527819cea188e458 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Fri, 23 Jan 2015 15:16:25 +0100 Subject: [PATCH] matroskamux: Avoid using freed variable the name variable might have been attributed to pad_name, make sure we free it only *after* pad_name has been used. Coverity CID : 1265774 --- gst/matroska/matroska-mux.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gst/matroska/matroska-mux.c b/gst/matroska/matroska-mux.c index 72a8e2c..9e0fc08 100644 --- a/gst/matroska/matroska-mux.c +++ b/gst/matroska/matroska-mux.c @@ -2274,7 +2274,6 @@ gst_matroska_mux_request_new_pad (GstElement * element, newpad = g_object_new (GST_TYPE_MATROSKAMUX_PAD, "name", pad_name, "direction", templ->direction, "template", templ, NULL); - g_free (name); gst_matroskamux_pad_init (newpad); collect_pad = (GstMatroskaPad *) @@ -2291,6 +2290,8 @@ gst_matroska_mux_request_new_pad (GstElement * element, if (!gst_element_add_pad (element, GST_PAD (newpad))) goto pad_add_failed; + g_free (name); + mux->num_streams++; GST_DEBUG_OBJECT (newpad, "Added new request pad"); @@ -2301,6 +2302,7 @@ gst_matroska_mux_request_new_pad (GstElement * element, pad_add_failed: { GST_WARNING_OBJECT (mux, "Adding the new pad '%s' failed", pad_name); + g_free (name); gst_object_unref (newpad); return NULL; } -- 2.7.4