[FFmpeg-cvslog] segafilm: Check for memory allocation failures in segafilm demuxer.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Fri Oct 7 19:03:13 CEST 2011


On Fri, Oct 07, 2011 at 03:49:15AM +0200, Laurent Aimar wrote:
> ffmpeg | branch: master | Laurent Aimar <fenrir at elivagar.org> | Thu Oct  6 22:53:41 2011 +0200| [1775b92fee43f0527e2f5892a5a30450fa929722] | committer: Janne Grunau
> 
> segafilm: Check for memory allocation failures in segafilm demuxer.
> 
> Signed-off-by: Janne Grunau <janne-libav at jannau.net>
> 
> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1775b92fee43f0527e2f5892a5a30450fa929722
> ---
> 
>  libavformat/segafilm.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c
> index ea464f2..4bbacc5 100644
> --- a/libavformat/segafilm.c
> +++ b/libavformat/segafilm.c
> @@ -257,6 +257,10 @@ static int film_read_packet(AVFormatContext *s,
>              av_free(film->stereo_buffer);
>              film->stereo_buffer_size = sample->sample_size;
>              film->stereo_buffer = av_malloc(film->stereo_buffer_size);
> +            if (!film->stereo_buffer) {
> +                film->stereo_buffer_size = 0;
> +                return AVERROR(ENOMEM);
> +            }

This looks to me like using av_fast_malloc would simplify the code...


More information about the ffmpeg-cvslog mailing list