summaryrefslogtreecommitdiff
path: root/src/flash/nor/stellaris.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/stellaris.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/stellaris.c')
-rw-r--r--src/flash/nor/stellaris.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/flash/nor/stellaris.c b/src/flash/nor/stellaris.c
index 38374ffe..f7e2e8d9 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;