[vlc-devel] commit: Fixed double free. (Laurent Aimar )

git version control git at videolan.org
Fri Nov 21 21:00:12 CET 2008


vlc | branch: 0.9-bugfix | Laurent Aimar <fenrir at videolan.org> | Thu Nov 20 20:12:51 2008 +0100| [cde0d0f1712b8ed50f6a3eaa464ec70d2af9bf9b] | committer: Laurent Aimar 

Fixed double free.
(cherry picked from commit 469dc54720a2bafd6c2b7529904073b529d29f1f)

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

 modules/demux/ts.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/modules/demux/ts.c b/modules/demux/ts.c
index 6410223..b137578 100644
--- a/modules/demux/ts.c
+++ b/modules/demux/ts.c
@@ -1533,15 +1533,15 @@ static void PIDInit( ts_pid_t *pid, bool b_psi, ts_psi_t *p_owner )
 
         if( !b_old_valid )
         {
-            free( pid->psi );
             pid->psi = malloc( sizeof( ts_psi_t ) );
             if( pid->psi )
             {
-                pid->psi->handle= NULL;
-                pid->psi->i_prg = 0;
-                pid->psi->prg   = NULL;
+                pid->psi->handle = NULL;
+                TAB_INIT( pid->psi->i_prg, pid->psi->prg );
             }
         }
+        assert( pid->psi );
+
         pid->psi->i_pat_version  = -1;
         pid->psi->i_sdt_version  = -1;
         if( p_owner )
@@ -3136,7 +3136,7 @@ static void PMTCallBack( demux_t *p_demux, dvbpsi_pmt_t *p_pmt )
                  * parsing the SDT/EDT */
                 dvbpsi_DetachDemux( pid->psi->handle );
                 free( pid->psi );
-                pid->psi = 0;
+                pid->psi = NULL;
             }
             else
             {




More information about the vlc-devel mailing list