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.
Unified · Split
| @@ -347,6 +347,7 @@ static int gen_connect(URLContext *s, RTMPContext *rt) · 346 unmodified lines | |||
| 347 | if ((fourcc_str_len + 1) % 5 != 0) { | 347 | if ((fourcc_str_len + 1) % 5 != 0) { |
| 348 | av_log(s, AV_LOG_ERROR, "Malformed rtmp_enhanched_codecs, " | 348 | av_log(s, AV_LOG_ERROR, "Malformed rtmp_enhanched_codecs, " |
| 349 | "should be of the form hvc1[,av01][,vp09][,...]\n"); | 349 | "should be of the form hvc1[,av01][,vp09][,...]\n"); |
| 350 | ff_rtmp_packet_destroy(&pkt); | ||
| 350 | return AVERROR(EINVAL); | 351 | return AVERROR(EINVAL); |
| 351 | } | 352 | } |
| 352 | 353 | ||
| @@ -370,6 +371,7 @@ static int gen_connect(URLContext *s, RTMPContext *rt) · 17 unmodified lines | |||
| 370 | ff_amf_write_string(&p, fourcc); | 371 | ff_amf_write_string(&p, fourcc); |
| 371 | } else { | 372 | } else { |
| 372 | av_log(s, AV_LOG_ERROR, "Unsupported codec fourcc, %.*s\n", 4, fourcc_data); | 373 | av_log(s, AV_LOG_ERROR, "Unsupported codec fourcc, %.*s\n", 4, fourcc_data); |
| 374 | ff_rtmp_packet_destroy(&pkt); | ||
| 373 | return AVERROR_PATCHWELCOME; | 375 | return AVERROR_PATCHWELCOME; |
| 374 | } | 376 | } |
| 375 | 377 | ||