summaryrefslogtreecommitdiff
path: root/src/flash/nor/stm32x.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/flash/nor/stm32x.c')
-rw-r--r--src/flash/nor/stm32x.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/flash/nor/stm32x.c b/src/flash/nor/stm32x.c
index d11a8edc..8a3b8323 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;