element: unref message in _post_message when there is no implementation
authorAurélien Zanelli <aurelien.zanelli@parrot.com>
Thu, 10 Dec 2015 13:32:27 +0000 (14:32 +0100)
committerSebastian Dröge <sebastian@centricular.com>
Thu, 10 Dec 2015 14:44:31 +0000 (16:44 +0200)
'gst_element_post_message' takes the ownership of the message, so it
shall unref it when there is no post_message implementation. Otherwise
message is leaked.

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

gst/gstelement.c

index 832ac27a1ccbf510c5cb2db911d77623081839dc..dd26e2cf1f8a7c33c76610d91a7c317abf542350 100644 (file)
@@ -1743,6 +1743,8 @@ gst_element_post_message (GstElement * element, GstMessage * message)
   klass = GST_ELEMENT_GET_CLASS (element);
   if (klass->post_message)
     res = klass->post_message (element, message);
+  else
+    gst_message_unref (message);
 
   GST_TRACER_ELEMENT_POST_MESSAGE_POST (element, res);
   return res;