[vlc-devel] commit: Fix potential memleaks (CID 208) ( Rémi Duraffort )

git version control git at videolan.org
Mon Oct 6 15:46:47 CEST 2008


vlc | branch: 0.9-bugfix | Rémi Duraffort <ivoire at videolan.org> | Sun Oct  5 19:18:29 2008 +0200| [58672ec5b6837ddaa4a1a5397a9e1917bb6c8de8] | committer: Derk-Jan Hartman 

Fix potential memleaks (CID 208)
(cherry picked from commit 5ddb6667247a4f8eba46b92859f73f8da143bb90)

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

 modules/demux/real.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/modules/demux/real.c b/modules/demux/real.c
index 8dd214c..7574739 100644
--- a/modules/demux/real.c
+++ b/modules/demux/real.c
@@ -1491,6 +1491,8 @@ static int ReadCodecSpecificData( demux_t *p_demux, int i_len, int i_num )
             msg_Dbg( p_demux, "        - extra data=%d", fmt.i_extra );
 
             tk = malloc( sizeof( real_track_t ) );
+            if( !tk )
+                return VLC_ENOMEM;
             tk->i_id = i_num;
             tk->fmt = fmt;
             tk->i_frame = 0;
@@ -1527,9 +1529,11 @@ static int ReadCodecSpecificData( demux_t *p_demux, int i_len, int i_num )
             }
 
             /* Check if the calloc went correctly */
-            if( tk->p_subpackets == NULL )
+            if( !tk->p_subpackets && !tk->p_subpackets_timecode)
             {
-                tk->i_subpackets = 0;
+                free( tk->p_subpackets_timecode );
+                free( tk->p_subpackets );
+                free( tk );
                 msg_Err( p_demux, "Can't alloc subpacket" );
                 return VLC_EGENERIC;
             }




More information about the vlc-devel mailing list