summaryrefslogtreecommitdiff
path: root/src/flash/nor/pic32mx.c
diff options
context:
space:
mode:
authorSpencer Oliver <ntfreak@users.sourceforge.net>2010-05-29 15:43:42 +0100
committerSpencer Oliver <ntfreak@users.sourceforge.net>2010-05-29 15:43:42 +0100
commit86e851e1e263c79f19eb9db52553de99f19b8bb9 (patch)
treef27ce597e5d63329677f4f5967beb0437350452d /src/flash/nor/pic32mx.c
parent215353ef67434e41b13f8948dc7dceefc110e3fe (diff)
downloadopenocd+libswd-86e851e1e263c79f19eb9db52553de99f19b8bb9.tar.gz
openocd+libswd-86e851e1e263c79f19eb9db52553de99f19b8bb9.tar.bz2
openocd+libswd-86e851e1e263c79f19eb9db52553de99f19b8bb9.tar.xz
openocd+libswd-86e851e1e263c79f19eb9db52553de99f19b8bb9.zip
nor: fix memory leaks during probe
Fix similar memory leaks as per commit: ef72484b785ec7462a0415afea679d08b864c7fb Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
Diffstat (limited to 'src/flash/nor/pic32mx.c')
-rw-r--r--src/flash/nor/pic32mx.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/flash/nor/pic32mx.c b/src/flash/nor/pic32mx.c
index 58009ae5..2fe864d4 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);