[vlc-commits] mtp: fix initialization to avoid segfault on close

Romain Vimont git at videolan.org
Wed Nov 15 16:28:49 CET 2017


vlc/vlc-2.2 | branch: master | Romain Vimont <rom at rom1v.com> | Fri Nov 10 22:56:42 2017 +0100| [c56a751001b5aedc97642031addb356afb613248] | committer: Jean-Baptiste Kempf

mtp: fix initialization to avoid segfault on close

When an Android device is plugged with MTP disabled, the tracks may not
be retrieved.

In that branch of code, pp_items was never initialized, so the behavior
was undefined in CloseDevice() (on device unplug), often causing a
segfault.

Initialize it to NULL to fix the problem.

Signed-off-by: Romain Vimont <rom at rom1v.com>
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit 3ff283bc176b2dd2e83bb7cd7358eb2a0104124c)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/services_discovery/mtp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/modules/services_discovery/mtp.c b/modules/services_discovery/mtp.c
index a0e4ed5105..1f63bd5f53 100644
--- a/modules/services_discovery/mtp.c
+++ b/modules/services_discovery/mtp.c
@@ -196,6 +196,7 @@ static int AddDevice( services_discovery_t *p_sd,
                             CountTracks, p_sd ) ) == NULL )
         {
             msg_Warn( p_sd, "No tracks on the device" );
+            p_sd->p_sys->pp_items = NULL;
         }
         else
         {



More information about the vlc-commits mailing list