diff options
author | Lidong Yan <yldhome2d2@gmail.com> | 2025-06-29 14:45:26 +0800 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2025-07-03 23:05:27 +0200 |
commit | e68599f551de5a932bd7cb09db66d77ad52464dd (patch) | |
tree | 32013667e02811e9f13e76b8d7e38b79fa29dcdc | |
parent | 98afcd3da776df40955257daf63b6bf8c1fd764e (diff) | |
download | ffmpeg-e68599f551de5a932bd7cb09db66d77ad52464dd.tar.gz |
avformat/rtpdec_asf: fix leak in ff_wms_parse_sdp_a_line()
In ff_wms_parse_sdp_a_line(), it allocates memory in buf, but doesn't
free buf when avformat_alloc_context() failed. Add av_free(buf) before
return to prevent from leak.
Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavformat/rtpdec_asf.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/rtpdec_asf.c b/libavformat/rtpdec_asf.c index 9664623e57..b3b346f3cc 100644 --- a/libavformat/rtpdec_asf.c +++ b/libavformat/rtpdec_asf.c @@ -120,8 +120,10 @@ int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p) avformat_close_input(&rt->asf_ctx); } - if (!(iformat = av_find_input_format("asf"))) + if (!(iformat = av_find_input_format("asf"))) { + av_free(buf); return AVERROR_DEMUXER_NOT_FOUND; + } rt->asf_ctx = avformat_alloc_context(); if (!rt->asf_ctx) { |