[vlc-commits] dbus: Fix code style and add missing decref on error path

Mirsal Ennaime git at videolan.org
Tue Jan 29 15:02:30 CET 2013


vlc | branch: master | Mirsal Ennaime <mirsal at videolan.org> | Tue Jan 29 14:40:23 2013 +0100| [3ed48e03b85431f8024389f1b352854f0714ec3c] | committer: Mirsal Ennaime

dbus: Fix code style and add missing decref on error path

 * Add missing call to vlc_object_release() in MarshalMetadata
 * Separate code paths with empty lines
 * Fix bracket position in if blocks

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3ed48e03b85431f8024389f1b352854f0714ec3c
---

 modules/control/dbus/dbus_player.c |   23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/modules/control/dbus/dbus_player.c b/modules/control/dbus/dbus_player.c
index 5b197f0..7363850 100644
--- a/modules/control/dbus/dbus_player.c
+++ b/modules/control/dbus/dbus_player.c
@@ -679,24 +679,33 @@ static int
 MarshalMetadata( intf_thread_t *p_intf, DBusMessageIter *container )
 {
     DBusMessageIter a;
-    input_item_t *p_item = 0;
+    input_thread_t *p_input = NULL;
+    input_item_t   *p_item  = NULL;
 
-    input_thread_t *p_input;
-    if( ( p_input = playlist_CurrentInput( p_intf->p_sys->p_playlist ) ) ) {
+    if( ( p_input = playlist_CurrentInput( p_intf->p_sys->p_playlist ) ) )
+    {
         p_item = input_GetItem( p_input );
-        if( p_item ) {
+
+        if( p_item )
+        {
             int result = GetInputMeta( p_item, container );
+
             if (result != VLC_SUCCESS)
+            {
+                vlc_object_release( (vlc_object_t*) p_input );
                 return result;
+            }
         }
+
         vlc_object_release( (vlc_object_t*) p_input );
     }
-    if (!p_item) {
+
+    if (!p_item)
+    {
         // avoid breaking the type marshalling
         if( !dbus_message_iter_open_container( container, DBUS_TYPE_ARRAY, "{sv}", &a ) ||
-              !dbus_message_iter_close_container( container, &a ) ) {
+              !dbus_message_iter_close_container( container, &a ) )
             return VLC_ENOMEM;
-        }
     }
 
     return VLC_SUCCESS;



More information about the vlc-commits mailing list