VictoryasHD 1
VictoryasHD
Cancan.1234 1
Cancan.1234
Best Studio 1
Best Studio
mavzermete 1
mavzermete
Reklam vermek için turkmmo@gmail.com

CreateWhisper fix memory leak

  • Konuyu başlatan Konuyu başlatan banzai2
  • Başlangıç tarihi Başlangıç tarihi
  • Cevaplar Cevaplar 1
  • Görüntüleme Görüntüleme 329

Türkiye'nin ilk Cross-Platform OldSchool MOBİL & PC 1-99 Sunucusu Lamira2 6 Kasım'da Açılıyor! Büyük Açılışı Kaçırma HEMEN TIKLA!

std:🗺️:insert() does nothing when the key already exists. So every time CreateWhisper was called for an existing name (e.g. reopening a whisper window), a new CWhisper was allocated but never stored in the map and never freed — classic memory leak.

C++:
CWhisper * CPythonChat::CreateWhisper(const char * c_szName)
{
    CWhisper * pWhisper = CWhisper::New();
    m_WhisperMap.insert(TWhisperMap::value_type(c_szName, pWhisper));
    return pWhisper;
}

C++:
CWhisper * CPythonChat::CreateWhisper(const char * c_szName)
{
    TWhisperMap::iterator itor = m_WhisperMap.find(c_szName);
    if (itor != m_WhisperMap.end())
        return itor->second;

    CWhisper * pWhisper = CWhisper::New();
    m_WhisperMap.insert(TWhisperMap::value_type(c_szName, pWhisper));
    return pWhisper;
}
 

Şu an konuyu görüntüleyenler (Toplam : 0, Üye: 0, Misafir: 0)

Geri
Üst