openal: Unref pad template caps after usage
authorSebastian Rasmussen <sebras@hotmail.com>
Fri, 8 Aug 2014 23:27:53 +0000 (01:27 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Mon, 11 Aug 2014 06:50:12 +0000 (08:50 +0200)
https://bugzilla.gnome.org/show_bug.cgi?id=734520

ext/openal/gstopenalsink.c
ext/openal/gstopenalsrc.c

index 86f4709..1fa1c65 100644 (file)
@@ -575,7 +575,9 @@ gst_openal_sink_getcaps (GstBaseSink * basesink, GstCaps * filter)
 
   if (sink->default_device == NULL) {
     GstPad *pad = GST_BASE_SINK_PAD (basesink);
-    caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
+    GstCaps *tcaps = gst_pad_get_pad_template_caps (pad);
+    caps = gst_caps_copy (tcaps);
+    gst_caps_unref (tcaps);
   } else if (sink->probed_caps)
     caps = gst_caps_copy (sink->probed_caps);
   else {
index 1c246b5..ef48475 100644 (file)
@@ -335,9 +335,12 @@ gst_openal_src_getcaps (GstBaseSrc * basesrc, GstCaps * filter)
 
   if (device == NULL) {
     GstPad *pad = GST_BASE_SRC_PAD (basesrc);
+    GstCaps *tcaps = gst_pad_get_pad_template_caps (pad);
+
     GST_ELEMENT_WARNING (openalsrc, RESOURCE, OPEN_WRITE,
         ("Could not open temporary device."), GST_ALC_ERROR (device));
-    caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
+    caps = gst_caps_copy (tcaps);
+    gst_caps_unref (tcaps);
   } else if (openalsrc->probed_caps)
     caps = gst_caps_copy (openalsrc->probed_caps);
   else {