Fixed a memleak in ReadHotkeyConfig()

This commit is contained in:
Maciej Suminski 2017-03-04 08:34:59 +01:00
parent 68bcdec87e
commit 94d8e1e69c
1 changed files with 2 additions and 2 deletions

View File

@ -635,7 +635,8 @@ void ReadHotkeyConfig( const wxString& Appname, struct EDA_HOTKEY_CONFIG* aDescL
wxFileName fn( Appname ); wxFileName fn( Appname );
fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT ); fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
wxConfigBase* config = GetNewConfig( fn.GetFullPath() ); std::unique_ptr<wxConfigBase> config;
config.reset( GetNewConfig( fn.GetFullPath() ) );
if( !config->HasEntry( HOTKEYS_CONFIG_KEY ) ) if( !config->HasEntry( HOTKEYS_CONFIG_KEY ) )
{ {
@ -645,7 +646,6 @@ void ReadHotkeyConfig( const wxString& Appname, struct EDA_HOTKEY_CONFIG* aDescL
wxString data; wxString data;
config->Read( HOTKEYS_CONFIG_KEY, &data ); config->Read( HOTKEYS_CONFIG_KEY, &data );
delete config;
ParseHotkeyConfig( data, aDescList ); ParseHotkeyConfig( data, aDescList );
} }