From: Spencer O. <nt...@us...> - 2010-05-29 16:45:39
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 86e851e1e263c79f19eb9db52553de99f19b8bb9 (commit) from 215353ef67434e41b13f8948dc7dceefc110e3fe (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 86e851e1e263c79f19eb9db52553de99f19b8bb9 Author: Spencer Oliver <nt...@us...> Date: Sat May 29 15:43:42 2010 +0100 nor: fix memory leaks during probe Fix similar memory leaks as per commit: ef72484b785ec7462a0415afea679d08b864c7fb Signed-off-by: Spencer Oliver <nt...@us...> diff --git a/src/flash/nor/avrf.c b/src/flash/nor/avrf.c index 7cdab51..8472d83 100644 --- a/src/flash/nor/avrf.c +++ b/src/flash/nor/avrf.c @@ -324,6 +324,12 @@ static int avrf_probe(struct flash_bank *bank) if (avr_info != NULL) { + if (bank->sectors) + { + free(bank->sectors); + bank->sectors = NULL; + } + // chip found bank->base = 0x00000000; bank->size = (avr_info->flash_page_size * avr_info->flash_page_num); diff --git a/src/flash/nor/pic32mx.c b/src/flash/nor/pic32mx.c index 58009ae..2fe864d 100644 --- a/src/flash/nor/pic32mx.c +++ b/src/flash/nor/pic32mx.c @@ -560,6 +560,12 @@ static int pic32mx_probe(struct flash_bank *bank) LOG_INFO("flash size = %" PRId32 "kbytes", num_pages / 1024); + if (bank->sectors) + { + free(bank->sectors); + bank->sectors = NULL; + } + /* calculate numbers of pages */ num_pages /= page_size; bank->size = (num_pages * page_size); diff --git a/src/flash/nor/stellaris.c b/src/flash/nor/stellaris.c index 38374ff..f7e2e8d 100644 --- a/src/flash/nor/stellaris.c +++ b/src/flash/nor/stellaris.c @@ -1065,6 +1065,12 @@ static int stellaris_probe(struct flash_bank *bank) if (retval != ERROR_OK) return retval; + if (bank->sectors) + { + free(bank->sectors); + bank->sectors = NULL; + } + /* provide this for the benefit of the NOR flash framework */ bank->size = 1024 * stellaris_info->num_pages; bank->num_sectors = stellaris_info->num_pages; diff --git a/src/flash/nor/stm32x.c b/src/flash/nor/stm32x.c index d11a8ed..8a3b832 100644 --- a/src/flash/nor/stm32x.c +++ b/src/flash/nor/stm32x.c @@ -775,6 +775,12 @@ static int stm32x_probe(struct flash_bank *bank) /* calculate numbers of pages */ num_pages /= (page_size / 1024); + if (bank->sectors) + { + free(bank->sectors); + bank->sectors = NULL; + } + bank->base = 0x08000000; bank->size = (num_pages * page_size); bank->num_sectors = num_pages; diff --git a/src/flash/nor/tms470.c b/src/flash/nor/tms470.c index c1681f1..343c43e 100644 --- a/src/flash/nor/tms470.c +++ b/src/flash/nor/tms470.c @@ -139,6 +139,12 @@ static int tms470_read_part_info(struct flash_bank *bank) rom_flash = (device_ident_reg >> 10) & 1; part_number = (device_ident_reg >> 3) & 0x7f; + if (bank->sectors) + { + free(bank->sectors); + bank->sectors = NULL; + } + /* * If the part number is known, determine if the flash bank is valid * based on the base address being within the known flash bank ----------------------------------------------------------------------- Summary of changes: src/flash/nor/avrf.c | 6 ++++++ src/flash/nor/pic32mx.c | 6 ++++++ src/flash/nor/stellaris.c | 6 ++++++ src/flash/nor/stm32x.c | 6 ++++++ src/flash/nor/tms470.c | 6 ++++++ 5 files changed, 30 insertions(+), 0 deletions(-) hooks/post-receive -- Main OpenOCD repository |