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 <502024330...@smail.nju.edu.cn>
---
 libavformat/rtpdec_asf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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) {
-- 
2.50.0.106.gf0135a9047.dirty

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to