[vlc-commits] cli: fix leaks in adev

Rémi Denis-Courmont git at videolan.org
Sat Oct 17 20:35:54 CEST 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Oct 17 14:47:47 2020 +0300| [66ec5eb61afbfde80148dee93a623d8e219cb53d] | committer: Rémi Denis-Courmont

cli: fix leaks in adev

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

 modules/control/cli/player.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/modules/control/cli/player.c b/modules/control/cli/player.c
index 667d8e26e4..3698f8fb25 100644
--- a/modules/control/cli/player.c
+++ b/modules/control/cli/player.c
@@ -578,13 +578,15 @@ void AudioDevice(intf_thread_t *intf, char const *cmd, vlc_value_t cur)
 
     if (setdev)
     {
-        int i;
-        for (i = 0; i < n; ++i)
+        for (int i = 0; i < n; ++i)
+        {
             if (!strcmp(cur.psz_string, ids[i]))
-                break;
-        if (i < n)
-            vlc_player_osd_Message(player,
-                                   _("Audio device: %s"), names[i]);
+                vlc_player_osd_Message(player,
+                                       _("Audio device: %s"), names[i]);
+
+            free(names[i]);
+            free(ids[i]);
+        }
     }
     else
     {



More information about the vlc-commits mailing list