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 333510 - [PATCH] Fix gst_pad_new_from_template (gst_static_pad_template_get ()) leaks
[PATCH] Fix gst_pad_new_from_template (gst_static_pad_template_get ()) leaks
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal normal
: 0.10.4
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Reported: 2006-03-05 18:00 UTC by Christophe Fergeau
Modified: 2006-03-09 15:06 UTC
See Also:
GNOME target: ---
GNOME version: ---

Fix leaks (4.72 KB, patch)
2006-03-05 18:01 UTC, Christophe Fergeau
none Details | Review

Description Christophe Fergeau 2006-03-05 18:00:55 UTC
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)
      gst_pad_set_pad_template (GST_PAD_CAST (object),
          (GstPadTemplate *) g_value_dup_gst_object (value));

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.
Comment 1 Christophe Fergeau 2006-03-05 18:01:28 UTC
Created attachment 60701 [details] [review]
Fix leaks
Comment 2 Wim Taymans 2006-03-09 15:05:56 UTC
        * ext/pango/gsttextoverlay.c: (gst_text_overlay_init):
        * ext/pango/gsttextrender.c: (gst_text_render_init):
        * gst/adder/gstadder.c: (gst_adder_init):
        Don't leak padtemplates, patch by Christophe Fergeau,
        closes #333510.