Add null assignation on celt destroy

This commit is contained in:
maxime1907 2022-03-01 18:29:04 +01:00
parent 764e8da072
commit 954ff32e1b
2 changed files with 12 additions and 6 deletions

View File

@ -409,19 +409,19 @@ void CVoice::SDK_OnUnload()
{ {
smutils->RemoveGameFrameHook(::OnGameFrame); smutils->RemoveGameFrameHook(::OnGameFrame);
if(m_VoiceDetour) if (m_VoiceDetour)
{ {
m_VoiceDetour->Destroy(); m_VoiceDetour->Destroy();
m_VoiceDetour = NULL; m_VoiceDetour = NULL;
} }
if(m_ListenSocket != -1) if (m_ListenSocket != -1)
{ {
close(m_ListenSocket); close(m_ListenSocket);
m_ListenSocket = -1; m_ListenSocket = -1;
} }
for(int Client = 0; Client < MAX_CLIENTS; Client++) for (int Client = 0; Client < MAX_CLIENTS; Client++)
{ {
if(m_aClients[Client].m_Socket != -1) if(m_aClients[Client].m_Socket != -1)
{ {
@ -430,11 +430,17 @@ void CVoice::SDK_OnUnload()
} }
} }
if(m_pCodec) if (m_pCodec)
{
celt_encoder_destroy(m_pCodec); celt_encoder_destroy(m_pCodec);
m_pCodec = NULL;
}
if(m_pMode) if (m_pMode)
{
celt_mode_destroy(m_pMode); celt_mode_destroy(m_pMode);
m_pMode = NULL;
}
} }
void CVoice::OnGameFrame(bool simulating) void CVoice::OnGameFrame(bool simulating)

View File

@ -40,7 +40,7 @@
/* Basic information exposed publicly */ /* Basic information exposed publicly */
#define SMEXT_CONF_NAME "Voice" #define SMEXT_CONF_NAME "Voice"
#define SMEXT_CONF_DESCRIPTION "Inject voice data over existing clients" #define SMEXT_CONF_DESCRIPTION "Inject voice data over existing clients"
#define SMEXT_CONF_VERSION "1.1" #define SMEXT_CONF_VERSION "1.2"
#define SMEXT_CONF_AUTHOR "BotoX" #define SMEXT_CONF_AUTHOR "BotoX"
#define SMEXT_CONF_URL "" #define SMEXT_CONF_URL ""
#define SMEXT_CONF_LOGTAG "VOICE" #define SMEXT_CONF_LOGTAG "VOICE"