avimux: 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 : 1265775
This commit is contained in:
Edward Hervey 2015-01-23 15:13:55 +01:00
parent c88e042458
commit 8abfd9d720

View file

@ -997,8 +997,6 @@ gst_avi_mux_request_new_pad (GstElement * element,
newpad = gst_pad_new_from_template (templ, pad_name);
g_free (name);
avipad->collect = gst_collect_pads_add_pad (avimux->collect,
newpad, sizeof (GstAviCollectData), NULL, TRUE);
((GstAviCollectData *) (avipad->collect))->avipad = avipad;
@ -1006,6 +1004,8 @@ gst_avi_mux_request_new_pad (GstElement * element,
if (!gst_element_add_pad (element, newpad))
goto pad_add_failed;
g_free (name);
GST_DEBUG_OBJECT (newpad, "Added new request pad");
return newpad;
@ -1034,6 +1034,7 @@ too_many_video_pads:
pad_add_failed:
{
GST_WARNING_OBJECT (avimux, "Adding the new pad '%s' failed", pad_name);
g_free (name);
gst_object_unref (newpad);
return NULL;
}