This is an automated email from Gerrit.

Matthias Welwarsky (matth...@welwarsky.de) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/4481

-- gerrit

commit 051a94e0b150c2acbcbfb714997019b528faf43c
Author: Matthias Welwarsky <matthias.welwar...@sysgo.com>
Date:   Fri Apr 6 12:38:12 2018 +0200

    target: free target SMP list on shutdown
    
    On SMP targets, the "target smp" command creates a list of targets
    that belong to the SMP cluster. Free this list when a target gets
    destroyed on shutdown. For simplicity, the complete list is free'd as
    soon as the first target of the SMP cluster is destroyed instead of
    individually removing targets from the list.
    
    Change-Id: Ie217ae1efb2e819c288ff3b1155aeaf0a19b06be
    Signed-off-by: Matthias Welwarsky <matthias.welwar...@sysgo.com>

diff --git a/src/target/target.c b/src/target/target.c
index e16e532..a8129c4 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -1911,6 +1911,18 @@ static void target_destroy(struct target *target)
                free(target->working_areas);
        }
 
+       /* release the targets SMP list */
+       if (target->smp) {
+               struct target_list *head = target->head;
+               while (head != NULL) {
+                       struct target_list *pos = head->next;
+                       head->target->smp = 0;
+                       free(head);
+                       head = pos;
+               }
+               target->smp = 0;
+       }
+
        free(target->type);
        free(target->trace_info);
        free(target->fileio_info);

-- 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to