Fix srp.cpp:815 leak
authorest31 <MTest31@outlook.com>
Mon, 27 Jul 2015 05:44:48 +0000 (07:44 +0200)
committerest31 <MTest31@outlook.com>
Mon, 27 Jul 2015 06:15:39 +0000 (08:15 +0200)
Thanks @Zeno-

src/client.cpp
src/network/clientpackethandler.cpp

index 74072d9d7c3f52cfd49367d181339abcc0ef8347..63f720f0404edaeb01c8b08af0841a5fb85c2aae 100644 (file)
@@ -974,6 +974,7 @@ void Client::deleteAuthData()
                case AUTH_MECHANISM_NONE:
                        break;
        }
+       m_chosen_auth_mech = AUTH_MECHANISM_NONE;
 }
 
 
@@ -1060,7 +1061,6 @@ void Client::startAuth(AuthMechanism chosen_auth_mechanism)
 
                        NetworkPacket resp_pkt(TOSERVER_SRP_BYTES_A, 0);
                        resp_pkt << std::string(bytes_A, len_A) << based_on;
-                       free(bytes_A);
                        Send(&resp_pkt);
                        break;
                }
index 2133543d982818a660242351ec604c6928224767..86091bc880d1c7d84ba9c50e17e4792516c01183 100644 (file)
@@ -100,7 +100,6 @@ void Client::handleCommand_Hello(NetworkPacket* pkt)
 
 void Client::handleCommand_AuthAccept(NetworkPacket* pkt)
 {
-       m_chosen_auth_mech = AUTH_MECHANISM_NONE;
        deleteAuthData();
 
        v3f playerpos;
@@ -126,7 +125,6 @@ void Client::handleCommand_AuthAccept(NetworkPacket* pkt)
 }
 void Client::handleCommand_AcceptSudoMode(NetworkPacket* pkt)
 {
-       m_chosen_auth_mech = AUTH_MECHANISM_NONE;
        deleteAuthData();
 
        m_password = m_new_password;
@@ -144,7 +142,6 @@ void Client::handleCommand_DenySudoMode(NetworkPacket* pkt)
        m_chat_queue.push(L"Password change denied. Password NOT changed.");
        // reset everything and be sad
        deleteAuthData();
-       m_chosen_auth_mech = AUTH_MECHANISM_NONE;
 }
 void Client::handleCommand_InitLegacy(NetworkPacket* pkt)
 {