diff options
author | Christopher Head <chead@zaber.com> | 2018-05-14 13:06:39 -0700 |
---|---|---|
committer | Tomas Vanek <vanekt@fbl.cz> | 2018-07-03 07:48:04 +0100 |
commit | f9d7554ee490e39a5cba3cd4eb2c28ec72ba407f (patch) | |
tree | 761f630cee120b11a3f9ea4f8f60822e4e7bbe50 /src/flash/nor/stm32f2x.c | |
parent | 47d0930410bc6f9fdf1d59a60a60fcca4c7bb1d4 (diff) |
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/stm32f2x.c')
-rw-r--r-- | src/flash/nor/stm32f2x.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/flash/nor/stm32f2x.c b/src/flash/nor/stm32f2x.c index 43f5d12d..413d04d7 100644 --- a/src/flash/nor/stm32f2x.c +++ b/src/flash/nor/stm32f2x.c @@ -599,8 +599,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) { |