[gstreamer-bugs] [Bug 333510] New: [PATCH] Fix gst_pad_new_from_template (gst_static_pad_template_get ()) leaks

GStreamer (bugzilla.gnome.org) bugzilla-daemon at bugzilla.gnome.org
Sun Mar 5 10:00:57 PST 2006


Do not reply to this via email (we are currently unable to handle email
responses and they get discarded).  You can add comments to this bug at
http://bugzilla.gnome.org/show_bug.cgi?id=333510
 GStreamer | gst-plugins-base | Ver: HEAD CVS

           Summary: [PATCH] Fix gst_pad_new_from_template
                    (gst_static_pad_template_get ()) leaks
           Product: GStreamer
           Version: HEAD CVS
          Platform: Other
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: gst-plugins-base
        AssignedTo: gstreamer-bugs at lists.sourceforge.net
        ReportedBy: teuf at gnome.org
         QAContact: gstreamer-bugs at lists.sourceforge.net
     GNOME version: Unspecified
   GNOME milestone: Unspecified


Many elements use something like:
overlay->video_sinkpad =
     gst_pad_new_from_template (gst_static_pad_template_get
     (&video_sink_template_factory), "video_sink");
in their _init function. This is wrong since gst_pad_new_from_template creates
a copy of its parameter:

static void
gst_pad_set_property (GObject * object, guint prop_id,
    const GValue * value, GParamSpec * pspec)
{
[...]    
   case PAD_PROP_TEMPLATE:
      gst_pad_set_pad_template (GST_PAD_CAST (object),
          (GstPadTemplate *) g_value_dup_gst_object (value));
      break;
}


GstPad *
gst_pad_new_from_template (GstPadTemplate * templ, const gchar * name)
{
  g_return_val_if_fail (GST_IS_PAD_TEMPLATE (templ), NULL);

  return g_object_new (GST_TYPE_PAD,
      "name", name, "direction", templ->direction, "template", templ, NULL);
}

gst_object_unref needs to be ran on the result of gst_static_pad_template_get
to avoid leaking this GstPadTemplate.


-- 
Configure bugmail: http://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.




More information about the Gstreamer-bugs mailing list