[vlc-devel] [PATCH] mtp: fix initialization to avoid segfault on close
Romain Vimont
rom at rom1v.com
Fri Nov 10 22:56:42 CET 2017
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>
---
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 56be3e3f6d..b64f84e3e2 100644
--- a/modules/services_discovery/mtp.c
+++ b/modules/services_discovery/mtp.c
@@ -198,6 +198,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
{
--
2.11.0
More information about the vlc-devel
mailing list