Fix a bot-breaking memory leak from early returning in ParseMediaDescription.

BUG=3791
R=henrike@webrtc.org, pbos@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/22589004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7109 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
jiayl@webrtc.org
2014-09-08 21:43:43 +00:00
parent c172320bd2
commit 0e52772aa9

View File

@ -2210,20 +2210,20 @@ bool ParseMediaDescription(const std::string& message,
codec_preference, pos, &content_name,
&transport, candidates, error));
} else if (HasAttribute(line, kMediaTypeData)) {
DataContentDescription* desc =
DataContentDescription* data_desc =
ParseContentDescription<DataContentDescription>(
message, cricket::MEDIA_TYPE_DATA, mline_index, protocol,
codec_preference, pos, &content_name,
&transport, candidates, error);
content.reset(data_desc);
int p;
if (desc && protocol == cricket::kMediaProtocolDtlsSctp &&
if (data_desc && protocol == cricket::kMediaProtocolDtlsSctp &&
rtc::FromString(fields[3], &p)) {
if (!AddSctpDataCodec(desc, p))
if (!AddSctpDataCodec(data_desc, p))
return false;
}
content.reset(desc);
// We should always use the default bandwidth for RTP-based data
// channels. Don't allow SDP to set the bandwidth, because that
// would give JS the opportunity to "break the Internet".