[vlc-commits] lua: fix NULL dereference and flawed logic

Rémi Denis-Courmont git at videolan.org
Mon Oct 28 17:35:19 CET 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Oct 28 18:34:35 2013 +0200| [f07b45fc153eb83369db1e5e3db8c45627d62685] | committer: Rémi Denis-Courmont

lua: fix NULL dereference and flawed logic

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

 modules/lua/extension.c |   27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/modules/lua/extension.c b/modules/lua/extension.c
index 7984396..3bf5a17 100644
--- a/modules/lua/extension.c
+++ b/modules/lua/extension.c
@@ -1207,21 +1207,20 @@ static void WatchTimerCallback( void *data )
 
     vlc_mutex_lock( &p_ext->p_sys->command_lock );
 
-    // Do we have a pending Deactivate command?
-    if( ( p_ext->p_sys->command &&
-          p_ext->p_sys->command->i_command == CMD_DEACTIVATE )
-        || ( p_ext->p_sys->command->next
-             && p_ext->p_sys->command->next->i_command == CMD_DEACTIVATE) )
-    {
-        if( p_ext->p_sys->progress )
-        {
-            dialog_ProgressDestroy( p_ext->p_sys->progress );
-            p_ext->p_sys->progress = NULL;
+    for( struct command_t *cmd = p_ext->p_sys->command;
+         cmd != NULL;
+         cmd = cmd->next )
+        if( cmd->i_command == CMD_DEACTIVATE )
+        {   /* We have a pending Deactivate command... */
+            if( p_ext->p_sys->progress )
+            {
+                dialog_ProgressDestroy( p_ext->p_sys->progress );
+                p_ext->p_sys->progress = NULL;
+            }
+            vlc_mutex_unlock( &p_ext->p_sys->command_lock );
+            KillExtension( p_mgr, p_ext );
+            return;
         }
-        vlc_mutex_unlock( &p_ext->p_sys->command_lock );
-        KillExtension( p_mgr, p_ext );
-        return;
-    }
 
     if( !p_ext->p_sys->progress )
     {



More information about the vlc-commits mailing list