diff options
author | Spencer Oliver <spen@spen-soft.co.uk> | 2014-03-28 11:27:48 +0000 |
---|---|---|
committer | Paul Fertser <fercerpav@gmail.com> | 2014-03-29 08:04:55 +0000 |
commit | 0f566ae1a78b054328de2123ff36f93bc5b8fd93 (patch) | |
tree | fd8cde9ec40f60839d8c931dfed1cf407ba23d23 /src/target/arm_adi_v5.c | |
parent | 0cb9778368ddda6dc193752034de6f8aafeb2454 (diff) |
target: remove memory leaks
Found by clang.
Change-Id: Ifb25dca52f8d9e8e46a35f0947a7239f26eb3757
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2067
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Jörg Wunsch <openocd@uriah.heep.sax.de>
Diffstat (limited to 'src/target/arm_adi_v5.c')
-rw-r--r-- | src/target/arm_adi_v5.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c index 4a1e42c0..4bfa7f79 100644 --- a/src/target/arm_adi_v5.c +++ b/src/target/arm_adi_v5.c @@ -409,8 +409,10 @@ int mem_ap_read(struct adiv5_dap *dap, uint8_t *buffer, uint32_t size, uint32_t } retval = dap_setup_accessport_tar(dap, address); - if (retval != ERROR_OK) + if (retval != ERROR_OK) { + free(read_buf); return retval; + } /* Queue up all reads. Each read will store the entire DRW word in the read buffer. How many * useful bytes it contains, and their location in the word, depends on the type of transfer |