From 416c44615a257c11258c29f20f1f3d54c7e79f02 Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Wed, 30 Oct 2013 00:14:11 -0500 Subject: [PATCH] memory leak, comments --- common/fp_lib_table.cpp | 14 ++++++++------ pcbnew/dialogs/dialog_fp_plugin_options.cpp | 7 +++++-- scripts/kicad-install.sh | 1 - 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/common/fp_lib_table.cpp b/common/fp_lib_table.cpp index 57b0f1e5b0..dc5388136a 100644 --- a/common/fp_lib_table.cpp +++ b/common/fp_lib_table.cpp @@ -388,15 +388,17 @@ std::string FP_LIB_TABLE::FormatOptions( const PROPERTIES* aProperties ) // the separation between name and value is '=' if( value.size() ) + { ret += '='; - for( std::string::const_iterator si = value.begin(); si != value.end(); ++si ) - { - // escape any separator in the value. - if( *si == OPT_SEP ) - ret += '\\'; + for( std::string::const_iterator si = value.begin(); si != value.end(); ++si ) + { + // escape any separator in the value. + if( *si == OPT_SEP ) + ret += '\\'; - ret += *si; + ret += *si; + } } } } diff --git a/pcbnew/dialogs/dialog_fp_plugin_options.cpp b/pcbnew/dialogs/dialog_fp_plugin_options.cpp index 523eccbb31..c47bbcce40 100644 --- a/pcbnew/dialogs/dialog_fp_plugin_options.cpp +++ b/pcbnew/dialogs/dialog_fp_plugin_options.cpp @@ -51,7 +51,7 @@ public: SetTitle( title ); - // add Cut, Copy, and Paste to wxGrids + // add Cut, Copy, and Paste to wxGrid m_grid->PushEventHandler( new GRID_TRICKS( m_grid ) ); string options = TO_UTF8( aOptions ); @@ -60,7 +60,8 @@ public: if( props ) { - m_grid->AppendRows( props->size() ); + if( props->size() > m_grid->GetNumberRows() ) + m_grid->AppendRows( props->size() - m_grid->GetNumberRows() ); int row = 0; for( PROPERTIES::const_iterator it = props->begin(); it != props->end(); ++it, ++row ) @@ -68,6 +69,8 @@ public: m_grid->SetCellValue( row, 0, FROM_UTF8( it->first.c_str() ) ); m_grid->SetCellValue( row, 1, FROM_UTF8( it->second.c_str() ) ); } + + delete props; } if( !col_width_option ) diff --git a/scripts/kicad-install.sh b/scripts/kicad-install.sh index cd226cce5f..955dc3aa7d 100755 --- a/scripts/kicad-install.sh +++ b/scripts/kicad-install.sh @@ -188,7 +188,6 @@ install_or_update() if [ $# -eq 1 -a "$1" == "--remove-sources" ]; then - # run this only once, kills .config & makes dirs echo "deleting $WORKING_TREES" rm_build_dir "$WORKING_TREES/kicad.bzr/build" rm_build_dir "$WORKING_TREES/kicad-lib.bzr/build"