armv8: valgrind memleak fixes

Various fixes for memory leaks, adds a target cleanup for aarch64
and ARM CTI objects.

Change-Id: I2267f0894df655fdf73d70c11ed03df0b8f8d07d
Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com>
Reviewed-on: http://openocd.zylin.com/4478
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
This commit is contained in:
Matthias Welwarsky
2018-03-26 09:45:46 +02:00
committed by Matthias Welwarsky
parent c0f81fbee7
commit 09076d10dd
7 changed files with 74 additions and 9 deletions

View File

@@ -219,6 +219,18 @@ static int cti_find_reg_offset(const char *name)
return -1;
}
int arm_cti_cleanup_all(void)
{
struct arm_cti_object *obj, *tmp;
list_for_each_entry_safe(obj, tmp, &all_cti, lh) {
free(obj->name);
free(obj);
}
return ERROR_OK;
}
COMMAND_HANDLER(handle_cti_dump)
{
struct arm_cti_object *obj = CMD_DATA;