From d9c0510e22821baa364306d867ffac45da0620c8 Mon Sep 17 00:00:00 2001 From: Martin Storsjö Date: Wed, 2 Feb 2011 11:08:01 +0200 Subject: rtsp: Don't store RTSPStream in AVStream->priv_data For mpegts in RTP, there isn't a direct mapping between RTSPStreams and AVStreams, and the RTSPStream isn't ever stored in AVStream->priv_data, which was earlier leaked. The fix for this leak, in ea7f080749d68a431226ce196014da38761a0d82, lead to double frees for other, normal RTP streams. This patch avoids storing RTSPStreams in AVStream->priv_data, thus avoiding the double free. The RTSPStreams are always available via RTSPState->rtsp_streams anyway. Tested with MS-RTSP, RealRTSP, DSS and mpegts/RTP. Signed-off-by: Luca Barbato --- libavformat/rtspenc.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'libavformat/rtspenc.c') diff --git a/libavformat/rtspenc.c b/libavformat/rtspenc.c index d54be1a5c2..34deeeb636 100644 --- a/libavformat/rtspenc.c +++ b/libavformat/rtspenc.c @@ -79,14 +79,12 @@ int ff_rtsp_setup_output_streams(AVFormatContext *s, const char *addr) /* Set up the RTSPStreams for each AVStream */ for (i = 0; i < s->nb_streams; i++) { RTSPStream *rtsp_st; - AVStream *st = s->streams[i]; rtsp_st = av_mallocz(sizeof(RTSPStream)); if (!rtsp_st) return AVERROR(ENOMEM); dynarray_add(&rt->rtsp_streams, &rt->nb_rtsp_streams, rtsp_st); - st->priv_data = rtsp_st; rtsp_st->stream_index = i; av_strlcpy(rtsp_st->control_url, rt->control_uri, sizeof(rtsp_st->control_url)); -- cgit v1.2.3