diff options
Diffstat (limited to 'src/flash/nor/at91sam7.c')
-rw-r--r-- | src/flash/nor/at91sam7.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/flash/nor/at91sam7.c b/src/flash/nor/at91sam7.c index 3e99c4a6..95ba084b 100644 --- a/src/flash/nor/at91sam7.c +++ b/src/flash/nor/at91sam7.c @@ -897,8 +897,10 @@ static int at91sam7_erase(struct flash_bank *bank, int first, int last) for (pos = 0; pos < nbytes; pos++) buffer[pos] = 0xFF; - if (at91sam7_write(bank, buffer, bank->sectors[first].offset, nbytes) != ERROR_OK) + if (at91sam7_write(bank, buffer, bank->sectors[first].offset, nbytes) != ERROR_OK) { + free(buffer); return ERROR_FLASH_OPERATION_FAILED; + } free(buffer); } |