Need to remove before inserting. Todo: is there a replace?

This commit is contained in:
ehouse 2009-07-31 12:39:47 +00:00
parent 503db9cc6f
commit bcc887c0b1

View file

@ -126,7 +126,13 @@ void
RelayConfigs::SetValueFor( const char* key, const char* value )
{
MutexLock ml( &m_values_mutex );
/* Does this leak in the case where we're replacing a value? */
/* Remove any entry already there */
map<const char*,const char*>::iterator iter = m_values.find(key);
if ( iter != m_values.end() ) {
m_values.erase(iter);
}
m_values.insert( pair<const char*,const char*>(strdup(key),strdup(value) ) );
}