[vlc-commits] dbus: Fix memleaks on error paths
Mirsal Ennaime
git at videolan.org
Tue Feb 5 13:37:30 CET 2013
vlc | branch: master | Mirsal Ennaime <mirsal at videolan.org> | Fri Feb 1 17:17:59 2013 +0100| [424d68f848e0fef69db0ee16499fe997951e3215] | committer: Mirsal Ennaime
dbus: Fix memleaks on error paths
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=424d68f848e0fef69db0ee16499fe997951e3215
---
modules/control/dbus/dbus.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/modules/control/dbus/dbus.c b/modules/control/dbus/dbus.c
index 1ab1ac3..0f87e73 100644
--- a/modules/control/dbus/dbus.c
+++ b/modules/control/dbus/dbus.c
@@ -159,7 +159,6 @@ vlc_module_end ()
static int Open( vlc_object_t *p_this )
{
intf_thread_t *p_intf = (intf_thread_t*)p_this;
-#warning Leaks on error paths!
/* initialisation of the connection */
if( !dbus_threads_init_default() )
@@ -276,8 +275,20 @@ static int Open( vlc_object_t *p_this )
goto error;
return VLC_SUCCESS;
+
error:
+ /* The dbus connection is private,
+ * so we are responsible for closing it
+ * XXX: Does this make sense when OOM ? */
+ dbus_connection_close( p_sys->p_conn );
dbus_connection_unref( p_conn );
+
+ vlc_array_destroy( p_sys->p_events );
+ vlc_array_destroy( p_sys->p_timeouts );
+ vlc_array_destroy( p_sys->p_watches );
+
+ vlc_mutex_destroy( &p_sys->lock );
+
free( p_sys );
return VLC_ENOMEM;
}
More information about the vlc-commits
mailing list