From 3a8a6e5c3e43bbe543bc7a0a7503173e4eadf2bc Mon Sep 17 00:00:00 2001 From: Spencer Oliver Date: Wed, 5 Jun 2013 20:19:11 +0100 Subject: [PATCH] cortex_a: remove memory leak on failure If mem_ap_sel_write_atomic_u32 fails then tmp_buff may not be released. Detected by clang. Change-Id: I3d5416bd47d0eea61f61ec02ac5e43c82f114108 Signed-off-by: Spencer Oliver Reviewed-on: http://openocd.zylin.com/1433 Tested-by: jenkins Reviewed-by: Andreas Fritiofson --- src/target/cortex_a.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/target/cortex_a.c b/src/target/cortex_a.c index 1bd473c7..96915807 100644 --- a/src/target/cortex_a.c +++ b/src/target/cortex_a.c @@ -1978,7 +1978,7 @@ static int cortex_a8_read_apb_ab_memory(struct target *target, retval = mem_ap_sel_write_atomic_u32(swjdp, armv7a->debug_ap, armv7a->debug_base + CPUDBG_DRCR, 1<<2); if (retval != ERROR_OK) - return retval; + goto error_free_buff_r; /* Read DSCR */ retval = mem_ap_sel_read_atomic_u32(swjdp, armv7a->debug_ap, -- 2.39.5