[vlc-commits] dbus_player: Fix leaks on error

Hugo Beauzée-Luyssen git at videolan.org
Wed Nov 22 17:37:37 CET 2017


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Wed Nov 22 17:26:48 2017 +0100| [cb96ac02ce0efad7624e67b22a7d15d4ff8032ac] | committer: Hugo Beauzée-Luyssen

dbus_player: Fix leaks on error

CID #1048913

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

 modules/control/dbus/dbus_player.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/modules/control/dbus/dbus_player.c b/modules/control/dbus/dbus_player.c
index 02413a636c..15680ec26d 100644
--- a/modules/control/dbus/dbus_player.c
+++ b/modules/control/dbus/dbus_player.c
@@ -766,9 +766,20 @@ int SeekedEmit( intf_thread_t * p_intf )
     { \
         if( VLC_SUCCESS != AddProperty( (intf_thread_t*) p_intf, \
                     &changed_properties, #prop, signature, Marshal##prop ) ) \
-            return DBUS_HANDLER_RESULT_NEED_MEMORY; \
+            { \
+                for( ; ppsz_properties[i]; ++i ) free( ppsz_properties[i] ); \
+                free( ppsz_properties ); \
+                dbus_message_iter_abandon_container( &args, &changed_properties ); \
+                return DBUS_HANDLER_RESULT_NEED_MEMORY; \
+            } \
+    }
+#define PROPERTY_MAPPING_END else \
+    { \
+        for( ; ppsz_properties[i]; ++i ) free( ppsz_properties[i] ); \
+        free( ppsz_properties ); \
+        dbus_message_iter_abandon_container( &args, &changed_properties ); \
+        return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; \
     }
-#define PROPERTY_MAPPING_END else { return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; }
 
 /**
  * PropertiesChangedSignal() synthetizes and sends the



More information about the vlc-commits mailing list