[vlc-commits] cli: fix leaks on error

Rémi Denis-Courmont git at videolan.org
Sun Nov 29 14:55:40 CET 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Nov 29 12:08:00 2020 +0200| [48a2330338e590614d971502c9c3e729222d87f0] | committer: Rémi Denis-Courmont

cli: fix leaks on error

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

 modules/control/cli/cli.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/modules/control/cli/cli.c b/modules/control/cli/cli.c
index d0a60a3231..ed8978df48 100644
--- a/modules/control/cli/cli.c
+++ b/modules/control/cli/cli.c
@@ -621,7 +621,6 @@ static void *Run( void *data )
  *****************************************************************************/
 static int Activate( vlc_object_t *p_this )
 {
-    /* FIXME: This function is full of memory leaks and bugs in error paths. */
     intf_thread_t *p_intf = (intf_thread_t*)p_this;
     char *psz_host, *psz_unix_path = NULL;
     int  *pi_socket = NULL;
@@ -798,6 +797,9 @@ static int Activate( vlc_object_t *p_this )
     return VLC_SUCCESS;
 
 error:
+    if (p_sys->player_cli != NULL)
+        DeregisterPlayer(p_intf, p_sys->player_cli);
+    tdestroy(p_sys->commands, free);
     net_ListenClose( pi_socket );
     free( psz_unix_path );
     free( p_sys );



More information about the vlc-commits mailing list