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

Rémi Denis-Courmont git at videolan.org
Mon Oct 28 18:12:46 CET 2013


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

lua: fix NULL dereference and flawed logic

(cherry picked from commit f07b45fc153eb83369db1e5e3db8c45627d62685)

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

 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 4a7105e..bef8b57 100644
--- a/modules/lua/extension.c
+++ b/modules/lua/extension.c
@@ -1206,21 +1206,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