From ec53836d833239645da5328cc47d5b306219a947 Mon Sep 17 00:00:00 2001 From: def Date: Fri, 19 Dec 2014 17:51:04 +0100 Subject: [PATCH] Don't lose memory --- src/game/server/score/sql_score.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/game/server/score/sql_score.cpp b/src/game/server/score/sql_score.cpp index d2cf46fb8..778d275a9 100644 --- a/src/game/server/score/sql_score.cpp +++ b/src/game/server/score/sql_score.cpp @@ -1584,13 +1584,6 @@ void CSqlScore::RandomUnfinishedMap(int ClientID, int stars) void CSqlScore::SaveTeam(int Team, const char* Code, int ClientID, const char* Server) { - CSqlTeamSave *Tmp = new CSqlTeamSave(); - Tmp->m_Team = Team; - Tmp->m_ClientID = ClientID; - str_copy(Tmp->m_Code, Code, 32); - str_copy(Tmp->m_Server, Server, sizeof(Tmp->m_Server)); - Tmp->m_pSqlData = this; - if((g_Config.m_SvTeam == 3 || (Team > 0 && Team < MAX_CLIENTS)) && ((CGameControllerDDRace*)(GameServer()->m_pController))->m_Teams.Count(Team) > 0) { if(((CGameControllerDDRace*)(GameServer()->m_pController))->m_Teams.GetSaving(Team)) @@ -1603,6 +1596,13 @@ void CSqlScore::SaveTeam(int Team, const char* Code, int ClientID, const char* S return; } + CSqlTeamSave *Tmp = new CSqlTeamSave(); + Tmp->m_Team = Team; + Tmp->m_ClientID = ClientID; + str_copy(Tmp->m_Code, Code, 32); + str_copy(Tmp->m_Server, Server, sizeof(Tmp->m_Server)); + Tmp->m_pSqlData = this; + void *SaveThread = thread_create(SaveTeamThread, Tmp); #if defined(CONF_FAMILY_UNIX) pthread_detach((pthread_t)SaveThread);