Fix uninitialized variable. If FindConstraint() returns false, we check |value| in two places and at that point, it can hold an uninitialized value. Caught by Linux Memcheck builder.

http://chromegw.corp.google.com/i/client.webrtc/builders/Linux%20Memcheck/builds/3351/steps/libjingle_peerconnection_unittest/logs/0A34BA777AB03D08

TBR=perkj@webrtc.org
BUG=

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

Cr-Commit-Position: refs/heads/master@{#8611}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8611 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
tommi@webrtc.org 2015-03-05 08:42:01 +00:00
parent fa67463d37
commit 5af41aabae

View File

@ -54,7 +54,7 @@ using rtc::scoped_refptr;
static bool ParseConstraintsForAnswer(
const MediaConstraintsInterface* constraints,
cricket::MediaSessionOptions* options) {
bool value;
bool value = false;
size_t mandatory_constraints_satisfied = 0;
// kOfferToReceiveAudio defaults to true according to spec.
@ -67,6 +67,7 @@ static bool ParseConstraintsForAnswer(
// kOfferToReceiveVideo defaults to false according to spec. But
// if it is an answer and video is offered, we should still accept video
// per default.
value = false;
if (!FindConstraint(constraints,
MediaConstraintsInterface::kOfferToReceiveVideo,
&value, &mandatory_constraints_satisfied) || value) {