gst-inspect: Fix memory leak in print_pad_templates_info
authorJimmy Ohn <yongjin.ohn@lge.com>
Wed, 28 Jun 2017 23:30:50 +0000 (08:30 +0900)
committerTim-Philipp Müller <tim@centricular.com>
Thu, 29 Jun 2017 14:26:36 +0000 (15:26 +0100)
gst_static_caps_get function returned allocated memory.
So, It should be free using gst_caps_unref.

https://bugzilla.gnome.org/show_bug.cgi?id=784311

tools/gst-inspect.c

index e420e4c..c885aba 100644 (file)
@@ -572,8 +572,11 @@ print_pad_templates_info (GstElement * element, GstElementFactory * factory)
       n_print ("    Availability: UNKNOWN!!!\n");
 
     if (padtemplate->static_caps.string) {
+      GstCaps *caps = gst_static_caps_get (&padtemplate->static_caps);
+
       n_print ("    Capabilities:\n");
-      print_caps (gst_static_caps_get (&padtemplate->static_caps), "      ");
+      print_caps (caps, "      ");
+      gst_caps_unref (caps);
     }
 
     n_print ("\n");