diff options
author | Andrey Nazarov <skuller@skuller.net> | 2013-01-25 22:11:39 +0400 |
---|---|---|
committer | Andrey Nazarov <skuller@skuller.net> | 2013-01-25 22:11:39 +0400 |
commit | 8c1cac88bff40d5401837eaa66c017030c7d38c6 (patch) | |
tree | 55c970d8dd1a4450b3019e8e65ec8484a1c05ae6 /src/common/common.c | |
parent | 75dadfce8c712aa47c8fc2ae801100d79705c4f0 (diff) |
Fix a memory leak when server fails to spawn.
Free the map loaded by SV_ParseMapCmd if an ERR_DROP is thrown before
server code takes ownership of the map.
Diffstat (limited to 'src/common/common.c')
-rw-r--r-- | src/common/common.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/common/common.c b/src/common/common.c index 31ea3fc..7a0e713 100644 --- a/src/common/common.c +++ b/src/common/common.c @@ -49,9 +49,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "server/server.h" #include "system/system.h" -#include <setjmp.h> - -static jmp_buf abortframe; // an ERR_DROP occured, exit the entire frame +jmp_buf com_abortframe; // an ERR_DROP occured, exit the entire frame static qboolean com_errorEntered; static char com_errorMsg[MAXERRORMSG]; // from Com_Printf/Com_Error @@ -561,13 +559,13 @@ abort: FS_Flush(com_logFile); } com_errorEntered = qfalse; - longjmp(abortframe, -1); + longjmp(com_abortframe, -1); } #ifdef _WIN32 void Com_AbortFrame(void) { - longjmp(abortframe, -1); + longjmp(com_abortframe, -1); } #endif @@ -865,7 +863,7 @@ Qcommon_Init */ void Qcommon_Init(int argc, char **argv) { - if (setjmp(abortframe)) + if (setjmp(com_abortframe)) Sys_Error("Error during initialization: %s", com_errorMsg); com_argc = argc; @@ -1048,7 +1046,7 @@ void Qcommon_Frame(void) static unsigned remaining; static float frac; - if (setjmp(abortframe)) { + if (setjmp(com_abortframe)) { return; // an ERR_DROP was thrown } |