From 4d9b4428fae2034bc57f1d8d10b6e60935fd2f08 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Thu, 27 Dec 2018 13:29:40 +0000 Subject: [PATCH] It's never a good idea to dereference a freed pointer. Fixes: lp:1809897 * https://bugs.launchpad.net/kicad/+bug/1809897 --- pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor.cpp b/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor.cpp index 0544213f20..2247753906 100644 --- a/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor.cpp +++ b/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor.cpp @@ -612,8 +612,11 @@ bool DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow() m_footprint->Value() = m_texts->at( 1 ); size_t i = 2; - for( BOARD_ITEM* item = m_footprint->GraphicalItemsList().GetFirst(); item; item = item->Next() ) + BOARD_ITEM* next; + + for( BOARD_ITEM* item = m_footprint->GraphicalItemsList().GetFirst(); item; item = next ) { + next = item->Next(); TEXTE_MODULE* textModule = dyn_cast( item ); if( textModule )