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