[FFmpeg-devel] [PATCH] Make the rtsp_st freeing conditional

Måns Rullgård mans
Wed Feb 2 00:07:31 CET 2011


Luca Barbato <lu_zero at gentoo.org> writes:

> On non mpegts in rtp the same memory is also pointed by st->priv_data,
> thus freed automatically.
>
> Fixes the double free introduced in 7cd3fa8e3248b2c83ab131d386fb7b24705034cb
> ---
>  libavformat/rtsp.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
> index 09e2f1e..1386e30 100644
> --- a/libavformat/rtsp.c
> +++ b/libavformat/rtsp.c
> @@ -532,7 +532,8 @@ void ff_rtsp_close_streams(AVFormatContext *s)
>              if (rtsp_st->dynamic_handler && rtsp_st->dynamic_protocol_context)
>                  rtsp_st->dynamic_handler->close(
>                      rtsp_st->dynamic_protocol_context);
> -            av_free(rtsp_st);
> +            if(!strcmp(ff_rtp_enc_name(rtsp_st->sdp_payload_type), "MP2T"))
> +                av_free(rtsp_st);
>          }
>      }
>      av_free(rt->rtsp_streams);
> -- 
> 1.7.2.2

This smells like a hack.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list