[vlc-devel] commit: Fix potential memleaks (CID 208) ( Rémi Duraffort )
git version control
git at videolan.org
Sun Oct 5 19:19:14 CEST 2008
vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Sun Oct 5 19:18:29 2008 +0200| [5ddb6667247a4f8eba46b92859f73f8da143bb90] | committer: Rémi Duraffort
Fix potential memleaks (CID 208)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5ddb6667247a4f8eba46b92859f73f8da143bb90
---
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 0960c4c..f7b71e3 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