From 10c62dc0c04be39086561fb12bd951a2542797d2 Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Wed, 4 Feb 2015 09:57:04 -0800 Subject: [PATCH] Fix crash when creating and destroying a TopMenu without map change (bug 6303). --- extensions/topmenus/TopMenu.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/extensions/topmenus/TopMenu.cpp b/extensions/topmenus/TopMenu.cpp index 2d21c07a..8d4738c5 100644 --- a/extensions/topmenus/TopMenu.cpp +++ b/extensions/topmenus/TopMenu.cpp @@ -80,12 +80,15 @@ TopMenu::~TopMenu() delete m_Config.cats[i]; } - /* Sweep players */ - for (size_t i = 0; i <= (size_t)m_max_clients; i++) + if (m_clients != NULL) { - TearDownClient(&m_clients[i]); + /* Sweep players */ + for (size_t i = 0; i <= (size_t)m_max_clients; i++) + { + TearDownClient(&m_clients[i]); + } + free(m_clients); } - free(m_clients); } unsigned int TopMenu::CalcMemUsage()