Mercurial > mplayer.hg
changeset 35285:920b8d28379b
Fix memleak when reading a file fails.
author | reimar |
---|---|
date | Sat, 10 Nov 2012 12:07:28 +0000 |
parents | b46668aabd5c |
children | ce056ec9e801 |
files | libmpdemux/demux_mf.c |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/demux_mf.c Sat Nov 10 12:03:26 2012 +0000 +++ b/libmpdemux/demux_mf.c Sat Nov 10 12:07:28 2012 +0000 @@ -61,7 +61,11 @@ { sh_video_t * sh_video = demuxer->video->sh; demux_packet_t * dp = new_demux_packet( fs.st_size ); - if ( !fread( dp->buffer,fs.st_size,1,f ) ) return 0; + if ( !fread( dp->buffer,fs.st_size,1,f ) ) { + fclose(f); + free_demux_packet(dp); + return 0; + } dp->pts=mf->curr_frame / sh_video->fps; dp->pos=mf->curr_frame; dp->flags=1;