History

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.

Lidong Yan committed 1 year ago

Commit b65fece1 parent 0d9f6801 file · +2 −0Browse files

Unified · Split

libavformat/rtmpproto.c+2−0
@@ -347,6 +347,7 @@ static int gen_connect(URLContext *s, RTMPContext *rt) · 346 unmodified lines
347347 if ((fourcc_str_len + 1) % 5 != 0) {
348348 av_log(s, AV_LOG_ERROR, "Malformed rtmp_enhanched_codecs, "
349349 "should be of the form hvc1[,av01][,vp09][,...]\n");
350+ ff_rtmp_packet_destroy(&pkt);
350351 return AVERROR(EINVAL);
351352 }
352353
@@ -370,6 +371,7 @@ static int gen_connect(URLContext *s, RTMPContext *rt) · 17 unmodified lines
370371 ff_amf_write_string(&p, fourcc);
371372 } else {
372373 av_log(s, AV_LOG_ERROR, "Unsupported codec fourcc, %.*s\n", 4, fourcc_data);
374+ ff_rtmp_packet_destroy(&pkt);
373375 return AVERROR_PATCHWELCOME;
374376 }
375377

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t