aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/flash/nor/lpc2000.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/flash/nor/lpc2000.c b/src/flash/nor/lpc2000.c
index 15d9eb81..0247e66d 100644
--- a/src/flash/nor/lpc2000.c
+++ b/src/flash/nor/lpc2000.c
@@ -679,9 +679,11 @@ static int lpc2000_iap_working_area_init(struct flash_bank *bank, struct working
}
int retval = target_write_memory(target, (*iap_working_area)->address, 4, 2, jump_gate);
- if (retval != ERROR_OK)
+ if (retval != ERROR_OK) {
LOG_ERROR("Write memory at address 0x%8.8" PRIx32 " failed (check work_area definition)",
(*iap_working_area)->address);
+ target_free_working_area(target, *iap_working_area);
+ }
return retval;
}