[vlc-commits] input: fix NULL dereference

Rémi Denis-Courmont git at videolan.org
Thu May 19 20:28:44 CEST 2016


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu May 19 21:28:32 2016 +0300| [d257781099d7c13d0127f95f9bc0ba136587d71b] | committer: Rémi Denis-Courmont

input: fix NULL dereference

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

 src/input/input.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/input/input.c b/src/input/input.c
index 74df8b6..d1b9b3e 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -1040,7 +1040,9 @@ static void LoadSlaves( input_thread_t *p_input )
         }
         vlc_mutex_unlock( &p_item->lock );
 
-        qsort( pp_slaves, i_slaves, sizeof(input_item_slave_t*), SlaveCompare );
+        if( i_slaves > 0 )
+            qsort( pp_slaves, i_slaves, sizeof (input_item_slave_t*),
+                   SlaveCompare );
 
         /* add all detected slaves */
         for( int i = 0; i < i_slaves && pp_slaves[i] != NULL; i++ )



More information about the vlc-commits mailing list