target/target: free what leaked in target_destroy()
Free event_action, fileio_info and working area. Change-Id: Iac81230423e92304b8e2c971d0ec71a96b693fc4 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4412 Tested-by: jenkins
This commit is contained in:
parent
63d7688245
commit
7ad11de2fa
|
@ -1892,8 +1892,24 @@ static void target_destroy(struct target *target)
|
|||
if (target->type->deinit_target)
|
||||
target->type->deinit_target(target);
|
||||
|
||||
struct target_event_action *teap = target->event_action;
|
||||
while (teap) {
|
||||
struct target_event_action *next = teap->next;
|
||||
Jim_DecrRefCount(teap->interp, teap->body);
|
||||
free(teap);
|
||||
teap = next;
|
||||
}
|
||||
|
||||
target_free_all_working_areas(target);
|
||||
/* Now we have none or only one working area marked as free */
|
||||
if (target->working_areas) {
|
||||
free(target->working_areas->backup);
|
||||
free(target->working_areas);
|
||||
}
|
||||
|
||||
free(target->type);
|
||||
free(target->trace_info);
|
||||
free(target->fileio_info);
|
||||
free(target->cmd_name);
|
||||
free(target);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue