GNOME Bugzilla – Bug 778739
smoothstreaming: change g_free() location
Last modified: 2018-01-20 11:14:18 UTC
If tmpl is NULL name is not free. so we need to fix as below. /* TODO use stream's name/bitrate/index as the pad name? */ if (streamtype == MSS_STREAM_TYPE_VIDEO) { name = g_strdup_printf ("video_%02u", mssdemux->n_videos++); tmpl = gst_static_pad_template_get (&gst_mss_demux_videosrc_template); } else if (streamtype == MSS_STREAM_TYPE_AUDIO) { name = g_strdup_printf ("audio_%02u", mssdemux->n_audios++); tmpl = gst_static_pad_template_get (&gst_mss_demux_audiosrc_template); } if (tmpl != NULL) { srcpad = GST_PAD_CAST (gst_pad_new_from_template (tmpl, name)); - g_free (name) gst_object_unref (tmpl); } + g_free (name);
Created attachment 345921 [details] patch for bug If tmpl is NULL, string is not free. so we need to modfiy it as patch.
I don't see how this can actually happen in practice? Did you find this in a real world scenario or with some code checker like coverity?
I use a static analysis tool for finding defect in a source code.
Thanks for the patch, but I don't think this change improves the code, it seems like the static analysis tool needs fixing, it should be able to detect this (or maybe it's being mislead by some g_return_if_fail() somewhere).