After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 778739 - smoothstreaming: change g_free() location
smoothstreaming: change g_free() location
Status: RESOLVED WONTFIX
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Windows
: Normal normal
: NONE
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-02-16 06:20 UTC by Hyunil Park
Modified: 2018-01-20 11:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch for bug (1010 bytes, text/plain)
2017-02-16 06:25 UTC, Hyunil Park
Details

Description Hyunil Park 2017-02-16 06:20:23 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);
Comment 1 Hyunil Park 2017-02-16 06:25:18 UTC
Created attachment 345921 [details]
patch for bug

If tmpl is NULL, string is not free.
so we need to modfiy it as patch.
Comment 2 Tim-Philipp Müller 2017-02-21 15:21:51 UTC
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?
Comment 3 Hyunil Park 2017-02-22 00:16:02 UTC
I use a static analysis tool for finding defect in a source code.
Comment 4 Tim-Philipp Müller 2018-01-20 11:14:18 UTC
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).