On Wed, Jun 04, 2014 at 11:20:09PM +0530, Nidhi Makhijani wrote:
> --- a/libavformat/oggparsespeex.c
> +++ b/libavformat/oggparsespeex.c
> @@ -75,6 +77,10 @@ static int speex_header(AVFormatContext *s, int idx) {
>          st->codec->extradata_size = os->psize;
>          st->codec->extradata = av_malloc(st->codec->extradata_size
>                                           + FF_INPUT_BUFFER_PADDING_SIZE);
> +        if (!st->codec->extradata) {
> +            st->codec->extradata_size = 0;
> +            return AVERROR(ENOMEM);
> +        }
>          memcpy(st->codec->extradata, p, st->codec->extradata_size);

I suggest you move setting the extradata_size after the allocation so
that it only gets set once on success instead of getting set and then
possibly reset on failure.

Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to