[vlc-devel] commit: Fix double free if there are several message queues - CID 135 ( Rafaël Carré )

git version control git at videolan.org
Fri May 30 15:18:42 CEST 2008


vlc | branch: 0.8.6-bugfix | Rafaël Carré <funman at videolan.org> | Fri May 30 15:20:21 2008 +0200| [39ed0e0d03d589e91a81821ea8514da76763308d]

Fix double free if there are several message queues - CID 135

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

 src/misc/messages.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/misc/messages.c b/src/misc/messages.c
index e12cbac..02edea8 100644
--- a/src/misc/messages.c
+++ b/src/misc/messages.c
@@ -210,6 +210,8 @@ void __msg_Unsubscribe( vlc_object_t *p_this, msg_subscription_t *p_sub )
     msg_bank_t *p_bank = &p_this->p_libvlc->msg_bank;
     int i,j;
 
+    free( p_sub ); /* we won't dereference the pointer */
+
     vlc_mutex_lock( &p_bank->lock );
 
     for( i = 0 ; i< p_bank->i_queues ; i++ )
@@ -222,7 +224,6 @@ void __msg_Unsubscribe( vlc_object_t *p_this, msg_subscription_t *p_sub )
                 REMOVE_ELEM( p_bank->pp_queues[i]->pp_sub,
                              p_bank->pp_queues[i]->i_sub,
                              j );
-                if( p_sub ) free( p_sub );
             }
         }
         vlc_mutex_unlock( & p_bank->pp_queues[i]->lock );




More information about the vlc-devel mailing list