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

Aurelien Jacobs aurel at gnuage.org
Fri Apr 9 00:33:18 CEST 2010


On Thu, Apr 08, 2010 at 06:24:58PM +0200, spyfeng wrote:
> Author: spyfeng
> Date: Thu Apr  8 18:24:58 2010
> New Revision: 5745
> 
> Log:
> fix possible memory leak when av_realloc() failure.
> 
> Modified:
>    mms/mmst.c
> 
> Modified: mms/mmst.c
> ==============================================================================
> --- mms/mmst.c	Thu Apr  8 18:02:41 2010	(r5744)
> +++ mms/mmst.c	Thu Apr  8 18:24:58 2010	(r5745)
> @@ -259,6 +259,7 @@ static MMSSCPacketType get_tcp_server_re
>      int read_result;
>      MMSSCPacketType packet_type= -1;
>      int done;
> +    uint8_t *p;
>  
>      do {
>          done= 1;
> @@ -323,13 +324,14 @@ static MMSSCPacketType get_tcp_server_re
>                          packet_type = SC_PKT_ASF_HEADER;
>                          // Store the asf header
>                          if(!mms->header_parsed) {
> -                            mms->asf_header = av_realloc(mms->asf_header,
> +                            p = av_realloc(mms->asf_header,
>                                                mms->asf_header_size
>                                                + mms->pkt_buf_len);
> -                            if (!mms->asf_header) {
> +                            if (!p) {
>                                  av_freep(&mms->asf_header);
>                                  return AVERROR(ENOMEM);
> -                            }
> +                            } else

Useless 'else'. The 'if' ends up with a 'return'.

Aurel


More information about the FFmpeg-soc mailing list