You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avformat/rtmpproto: fix rmtp packet leak in gen_connect()
In libavformat/rtmpproto.c:gen_connect(), if check on string length or check on codec fourcc failed, ff_rtmp_packet_create() allocated data in pkt would leak. Add ff_rtmp_packet_destory before return error code. Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn> Reviewed-by: Zhao Zhili <quinkblack@foxmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
committed by
Michael Niedermayer
parent
0d9f680b69
commit
b65fece0aa
@ -347,6 +347,7 @@ static int gen_connect(URLContext *s, RTMPContext *rt)
|
|||||||
if ((fourcc_str_len + 1) % 5 != 0) {
|
if ((fourcc_str_len + 1) % 5 != 0) {
|
||||||
av_log(s, AV_LOG_ERROR, "Malformed rtmp_enhanched_codecs, "
|
av_log(s, AV_LOG_ERROR, "Malformed rtmp_enhanched_codecs, "
|
||||||
"should be of the form hvc1[,av01][,vp09][,...]\n");
|
"should be of the form hvc1[,av01][,vp09][,...]\n");
|
||||||
|
ff_rtmp_packet_destroy(&pkt);
|
||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,6 +371,7 @@ static int gen_connect(URLContext *s, RTMPContext *rt)
|
|||||||
ff_amf_write_string(&p, fourcc);
|
ff_amf_write_string(&p, fourcc);
|
||||||
} else {
|
} else {
|
||||||
av_log(s, AV_LOG_ERROR, "Unsupported codec fourcc, %.*s\n", 4, fourcc_data);
|
av_log(s, AV_LOG_ERROR, "Unsupported codec fourcc, %.*s\n", 4, fourcc_data);
|
||||||
|
ff_rtmp_packet_destroy(&pkt);
|
||||||
return AVERROR_PATCHWELCOME;
|
return AVERROR_PATCHWELCOME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user