[FFmpeg-soc] [soc]: r5744 - mms/mmst.c

Ronald S. Bultje rsbultje at gmail.com
Thu Apr 8 18:06:14 CEST 2010


Hi,

On Thu, Apr 8, 2010 at 12:02 PM, spyfeng <subversion at mplayerhq.hu> wrote:
>                             mms->asf_header = av_realloc(mms->asf_header,
>                                               mms->asf_header_size
>                                               + mms->pkt_buf_len);
> -                            if (!mms->asf_header)
> +                            if (!mms->asf_header) {
> +                                av_freep(&mms->asf_header);
>                                 return AVERROR(ENOMEM);
> +                            }
>                             memcpy(mms->asf_header + mms->asf_header_size,
>                                                  mms->pkt_read_ptr,
>                                                  mms->pkt_buf_len);

You now this won't work right? :-). You're assigning NULL to a pointer
and then free'ing it. You'll want to save the return value of
av_realloc() into a new pointer, check the value, free()
mms->asf_header if it failed, and else overwrite mms->asf_header.

Ronald


More information about the FFmpeg-soc mailing list