aboutsummaryrefslogtreecommitdiff
path: root/src/flash/nor/stm32f1x.c
diff options
context:
space:
mode:
authorChristopher Head <chead@zaber.com>2018-05-14 13:06:39 -0700
committerTomas Vanek <vanekt@fbl.cz>2018-07-03 07:48:04 +0100
commitf9d7554ee490e39a5cba3cd4eb2c28ec72ba407f (patch)
tree761f630cee120b11a3f9ea4f8f60822e4e7bbe50 /src/flash/nor/stm32f1x.c
parent47d0930410bc6f9fdf1d59a60a60fcca4c7bb1d4 (diff)
downloadriscv-openocd-f9d7554ee490e39a5cba3cd4eb2c28ec72ba407f.zip
riscv-openocd-f9d7554ee490e39a5cba3cd4eb2c28ec72ba407f.tar.gz
riscv-openocd-f9d7554ee490e39a5cba3cd4eb2c28ec72ba407f.tar.bz2
flash/nor/stm32: Eliminate working area leak
On a specific early-return path, an allocated working area was not freed. Free it. Change-Id: I7c8fe51ff475f191624086996be1c77251780b77 Signed-off-by: Christopher Head <chead@zaber.com> Reviewed-on: http://openocd.zylin.com/4520 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Diffstat (limited to 'src/flash/nor/stm32f1x.c')
-rw-r--r--src/flash/nor/stm32f1x.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/flash/nor/stm32f1x.c b/src/flash/nor/stm32f1x.c
index 015988a..faada9a 100644
--- a/src/flash/nor/stm32f1x.c
+++ b/src/flash/nor/stm32f1x.c
@@ -585,8 +585,10 @@ static int stm32x_write_block(struct flash_bank *bank, const uint8_t *buffer,
retval = target_write_buffer(target, write_algorithm->address,
sizeof(stm32x_flash_write_code), stm32x_flash_write_code);
- if (retval != ERROR_OK)
+ if (retval != ERROR_OK) {
+ target_free_working_area(target, write_algorithm);
return retval;
+ }
/* memory buffer */
while (target_alloc_working_area_try(target, buffer_size, &source) != ERROR_OK) {