From a00e57df72224ca16a195822dfd00cb8cef337c1 Mon Sep 17 00:00:00 2001 From: historic_bruno Date: Thu, 10 Oct 2013 23:46:42 +0000 Subject: [PATCH] Fixes hypothetical mem leak in network code (and an error in Cppcheck), patch by Riemer, fixes #2122 This was SVN commit r13980. --- source/network/fsm.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/network/fsm.cpp b/source/network/fsm.cpp index 7b0bbeeda4..994d4dc238 100644 --- a/source/network/fsm.cpp +++ b/source/network/fsm.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2011 Wildfire Games. +/* Copyright (C) 2013 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -286,7 +286,11 @@ CFsmTransition* CFsm::AddTransition( // Create new transition CFsmTransition* pNewTransition = new CFsmTransition( state ); - if ( !pNewTransition ) return NULL; + if ( !pNewTransition ) + { + delete pEvent; + return NULL; + } // Setup new transition pNewTransition->SetEvent( pEvent );