[vlc-devel] commit: Fix a potential corruption in release_input_thread(). (Sam Hocevar )

git version control git at videolan.org
Fri Mar 21 23:26:46 CET 2008


vlc | branch: master | Sam Hocevar <sam at zoy.org> | Fri Mar 21 22:50:25 2008 +0100| [37558f4a013787f3a197db1de20aa6f0427ab2b1]

Fix a potential corruption in release_input_thread().

If the media instance owns the input and libvlc_media_instance_release()
is called immediately after libvlc_media_instance_stop(), there is a
chance that we try to free the input resources before the thread is
effectively terminated. To avoid this, we call input_DestroyThread()
instead of vlc_object_release() at the end of release_input_thread() when
the media instance owns the input thread.

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

 src/control/media_instance.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/control/media_instance.c b/src/control/media_instance.c
index c3ade3b..afcdfc2 100644
--- a/src/control/media_instance.c
+++ b/src/control/media_instance.c
@@ -92,11 +92,12 @@ static void release_input_thread( libvlc_media_instance_t *p_mi )
 
         /* We owned this one */
         input_StopThread( p_input_thread );
+        input_DestroyThread( p_input_thread );
 
         var_Destroy( p_input_thread, "drawable" );
     }
-
-    vlc_object_release( p_input_thread );
+    else
+        vlc_object_release( p_input_thread );
 
     p_mi->p_input_thread = NULL;
 }




More information about the vlc-devel mailing list