From 61554c8c3bb19b5325b7f024b2f17c56bc59aef8 Mon Sep 17 00:00:00 2001 From: Fletcher Dunn Date: Wed, 27 May 2026 16:01:18 -0700 Subject: [PATCH] ICE client: Small cleanup Delete unused function Don't dynamically allocate any attributes passed to SendSTUNResponsePacket (cherry picked from commit ea2b3842c6dd36eeb919195c1399f45e652345a3) --- .../clientlib/steamnetworkingsockets_ice_client.cpp | 8 ++------ .../clientlib/steamnetworkingsockets_ice_client.h | 1 - 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/steamnetworkingsockets/clientlib/steamnetworkingsockets_ice_client.cpp b/src/steamnetworkingsockets/clientlib/steamnetworkingsockets_ice_client.cpp index 6898b50..c50fb76 100644 --- a/src/steamnetworkingsockets/clientlib/steamnetworkingsockets_ice_client.cpp +++ b/src/steamnetworkingsockets/clientlib/steamnetworkingsockets_ice_client.cpp @@ -578,8 +578,6 @@ static bool SendSTUNResponsePacket( IRawUDPSocket* pSocket, int nEncoding, uint3 { uint32 messageBuffer[ k_nSTUN_MaxPacketSize_Bytes / 4 ]; const int nByteCount = EncodeSTUNPacket( messageBuffer, k_nSTUN_BindingResponse, nEncoding, pTransactionID, toAddr, pubKey, cubKey, pAttrs, nAttrs ); - for ( int i = 0; i < nAttrs; ++i ) - delete []( pAttrs[i].m_pData ); if ( nByteCount == 0 ) return false; @@ -1555,10 +1553,8 @@ not_stun: { STUNAttribute attrUsername; attrUsername.m_nType = k_nSTUN_Attr_UserName; - int nUsernameLength = (int)m_strIncomingUsername.size(); - attrUsername.m_nLength = nUsernameLength; - attrUsername.m_pData = new uint32[ (nUsernameLength + 3) / 4 ]; - V_memcpy( (void*)attrUsername.m_pData, m_strIncomingUsername.c_str(), m_strIncomingUsername.size() ); + attrUsername.m_nLength = (int)m_strIncomingUsername.size(); + attrUsername.m_pData = reinterpret_cast( m_strIncomingUsername.c_str() ); outAttrs.AddToTail( attrUsername ); } diff --git a/src/steamnetworkingsockets/clientlib/steamnetworkingsockets_ice_client.h b/src/steamnetworkingsockets/clientlib/steamnetworkingsockets_ice_client.h index f069e70..2dfb491 100644 --- a/src/steamnetworkingsockets/clientlib/steamnetworkingsockets_ice_client.h +++ b/src/steamnetworkingsockets/clientlib/steamnetworkingsockets_ice_client.h @@ -405,7 +405,6 @@ namespace SteamNetworkingSocketsLib { void GatherInterfaces(); void UpdateKeepalive( ICESessionInterface *pIntf ); - uint32 GetInterfaceLocalPreference( const SteamNetworkingIPAddr& addr ); void Think_KeepAliveOnCandidates( SteamNetworkingMicroseconds usecNow ); void Think_DiscoverServerReflexiveCandidates();