[vlc-commits] input/input: fix Control leak when input is stopped

Thomas Guillem git at videolan.org
Tue May 31 16:23:37 CEST 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue May 31 12:11:56 2016 +0200| [3b82f9f5acf9f05a9a9e91c657a66da73cc8e4ee] | committer: Thomas Guillem

input/input: fix Control leak when input is stopped

And don't call vlc_cond_signal if we don't have to.

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

 src/input/input.c |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index 951358f..5307203 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -1484,12 +1484,14 @@ void input_ControlPush( input_thread_t *p_input,
     input_thread_private_t *sys = p_input->p;
 
     vlc_mutex_lock( &sys->lock_control );
-    if( sys->is_stopped )
-        ;
-    else if( sys->i_control >= INPUT_CONTROL_FIFO_SIZE )
+    if( sys->is_stopped || sys->i_control >= INPUT_CONTROL_FIFO_SIZE )
     {
-        msg_Err( p_input, "input control fifo overflow, trashing type=%d",
-                 i_type );
+        if( sys->is_stopped )
+            msg_Dbg( p_input, "input control stopped, trashing type=%d",
+                     i_type );
+        else
+            msg_Err( p_input, "input control fifo overflow, trashing type=%d",
+                     i_type );
         if( p_val )
             ControlRelease( i_type, *p_val );
     }
@@ -1503,8 +1505,9 @@ void input_ControlPush( input_thread_t *p_input,
             memset( &c.val, 0, sizeof(c.val) );
 
         sys->control[sys->i_control++] = c;
+
+        vlc_cond_signal( &sys->wait_control );
     }
-    vlc_cond_signal( &sys->wait_control );
     vlc_mutex_unlock( &sys->lock_control );
 }
 



More information about the vlc-commits mailing list