From 4c9f5c5229f1cb3439916906c4287fa5dcf9d140 Mon Sep 17 00:00:00 2001 From: Timothee Besset Date: Fri, 7 Jun 2013 04:39:38 +0100 Subject: [PATCH] double free - and that's never crashed us before .. in how many years? --- libs/synapse/synapse.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libs/synapse/synapse.cpp b/libs/synapse/synapse.cpp index 48a6c4a..f42c6f4 100644 --- a/libs/synapse/synapse.cpp +++ b/libs/synapse/synapse.cpp @@ -97,6 +97,7 @@ CSynapseServer::CSynapseServer(){ CSynapseServer::~CSynapseServer(){ if ( m_api_name ) { xmlFree( m_api_name ); + m_api_name = NULL; } if ( m_content ) { g_free( m_content ); @@ -713,6 +714,7 @@ bool CSynapseServer::GetNextConfig( char **api_name, char **minor ){ if ( mpFocusedNode->type == XML_ELEMENT_NODE && !strcmp( (const char *)mpFocusedNode->name, "api" ) ) { if ( m_api_name ) { xmlFree( m_api_name ); + m_api_name = NULL; } m_api_name = xmlGetProp( mpFocusedNode, (const xmlChar *)"name" ); *api_name = (char *)m_api_name; @@ -736,6 +738,7 @@ bool CSynapseServer::GetConfigForAPI( const char *api, char **minor ) { if ( pNode->type == XML_ELEMENT_NODE && !strcmp( (const char *)pNode->name, "api" ) ) { if ( m_api_name ) { xmlFree( m_api_name ); + m_api_name = NULL; } m_api_name = xmlGetProp( pNode, (const xmlChar *)"name" ); if ( !strcmp( (const char *)m_api_name, api ) ) {