summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp')
-rw-r--r--protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp b/protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp
index 5184dab86e..efcb9551fb 100644
--- a/protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp
+++ b/protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp
@@ -108,9 +108,8 @@ std::vector<unsigned char> WALogin::readFeaturesUntilChallengeOrSuccess()
if (ProtocolTreeNode::tagEquals(root, "stream:features")) {
m_pConnection->supports_receipt_acks = root->getChild("receipt_acks") != NULL;
delete root;
- continue;
}
- if (ProtocolTreeNode::tagEquals(root, "challenge")) {
+ else if (ProtocolTreeNode::tagEquals(root, "challenge")) {
std::vector<unsigned char> challengedata(root->data->begin(), root->data->end());
delete root;
this->sendResponse(challengedata);
@@ -119,12 +118,14 @@ std::vector<unsigned char> WALogin::readFeaturesUntilChallengeOrSuccess()
m_pConnection->logData("Read success");
return std::vector<unsigned char>(data.begin(), data.end());
}
- if (ProtocolTreeNode::tagEquals(root, "success")) {
+ else if (ProtocolTreeNode::tagEquals(root, "success")) {
std::vector<unsigned char> ret(root->data->begin(), root->data->end());
this->parseSuccessNode(root);
delete root;
return ret;
}
+ else
+ delete root;
}
throw WAException("fell out of loop in readFeaturesAndChallenge", WAException::CORRUPT_STREAM_EX, 0);
}