This is an automated email from Gerrit.

Paul Fertser (fercer...@gmail.com) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/2542

-- gerrit

commit af6c6ec70f4476cc5be0ed398cf77cafa201a970
Author: Paul Fertser <fercer...@gmail.com>
Date:   Wed Feb 11 11:02:34 2015 +0300

    target/cortex_m: do not leak memory on reexamination
    
    This bug was exposed by Valgrind.
    
    Change-Id: If50878664d928c0a44e309ca1452089c1ac71466
    Signed-off-by: Paul Fertser <fercer...@gmail.com>

diff --git a/src/target/cortex_m.c b/src/target/cortex_m.c
index a5230b7..bce6705 100644
--- a/src/target/cortex_m.c
+++ b/src/target/cortex_m.c
@@ -1847,7 +1847,8 @@ int cortex_m_examine(struct target *target)
                cortex_m->fp_num_code = ((fpcr >> 8) & 0x70) | ((fpcr >> 4) & 
0xF);
                cortex_m->fp_num_lit = (fpcr >> 8) & 0xF;
                cortex_m->fp_code_available = cortex_m->fp_num_code;
-               cortex_m->fp_comparator_list = calloc(
+               if (!cortex_m->fp_comparator_list)
+                       cortex_m->fp_comparator_list = calloc(
                                cortex_m->fp_num_code + cortex_m->fp_num_lit,
                                sizeof(struct cortex_m_fp_comparator));
                cortex_m->fpb_enabled = fpcr & 1;
@@ -1865,7 +1866,8 @@ int cortex_m_examine(struct target *target)
                        cortex_m->fp_num_lit);
 
                /* Setup DWT */
-               cortex_m_dwt_setup(cortex_m, target);
+               if (!cortex_m->dwt_cache)
+                       cortex_m_dwt_setup(cortex_m, target);
 
                /* These hardware breakpoints only work for code in flash! */
                LOG_INFO("%s: hardware has %d breakpoints, %d watchpoints",

-- 

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to