target/arm926ejs: fix memory leaks
The memory leaks detected and fixed are: - arm register cache; - EmbeddedICE register cache; - arm_jtag_reset_callback internal data; - struct arm926ejs_common. Issue identified with valgrind. Tested on SPEAr320 based on arm926ejs. Change-Id: If2bed02c516051ce4d0eb29b204a3f3337fe5d6a Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5698 Tested-by: jenkins
This commit is contained in:
@@ -303,6 +303,22 @@ struct reg_cache *embeddedice_build_reg_cache(struct target *target,
|
||||
return reg_cache;
|
||||
}
|
||||
|
||||
/**
|
||||
* Free all memory allocated for EmbeddedICE register cache
|
||||
*/
|
||||
void embeddedice_free_reg_cache(struct reg_cache *reg_cache)
|
||||
{
|
||||
if (!reg_cache)
|
||||
return;
|
||||
|
||||
for (unsigned int i = 0; i < reg_cache->num_regs; i++)
|
||||
free(reg_cache->reg_list[i].value);
|
||||
|
||||
free(reg_cache->reg_list[0].arch_info);
|
||||
free(reg_cache->reg_list);
|
||||
free(reg_cache);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize EmbeddedICE module, if needed.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user