Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndriy Gelman <andriy.gelman@gmail.com>2020-10-12 23:36:06 +0300
committerAndriy Gelman <andriy.gelman@gmail.com>2020-11-21 18:13:28 +0300
commit122fcf1f407b60baf7a0322b73798958ca6108eb (patch)
treed45d7dbedeb7461d164664d9632faea334fdcbbf /libavformat/rtspdec.c
parent38bc4ba142b2304b2a0e2d86f271a28d51250fb9 (diff)
avformat/rtspdec: fix mem leaks in connect mode if init fails
Fixes #6334 Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
Diffstat (limited to 'libavformat/rtspdec.c')
-rw-r--r--libavformat/rtspdec.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c
index dfc84e71ba..8a2abc8ee9 100644
--- a/libavformat/rtspdec.c
+++ b/libavformat/rtspdec.c
@@ -735,22 +735,26 @@ static int rtsp_read_header(AVFormatContext *s)
rt->real_setup_cache = !s->nb_streams ? NULL :
av_mallocz_array(s->nb_streams, 2 * sizeof(*rt->real_setup_cache));
- if (!rt->real_setup_cache && s->nb_streams)
- return AVERROR(ENOMEM);
+ if (!rt->real_setup_cache && s->nb_streams) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
rt->real_setup = rt->real_setup_cache + s->nb_streams;
if (rt->initial_pause) {
/* do not start immediately */
} else {
if ((ret = rtsp_read_play(s)) < 0) {
- ff_rtsp_close_streams(s);
- ff_rtsp_close_connections(s);
- return ret;
+ goto fail;
}
}
}
return 0;
+
+fail:
+ rtsp_read_close(s);
+ return ret;
}
int ff_rtsp_tcp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,