This is an automated email from Gerrit.

Tomas Vanek ([email protected]) just uploaded a new patch set to Gerrit, which you 
can find at http://openocd.zylin.com/5328

-- gerrit

commit 32e9234444f74e24dad86da022fe596bd049820a
Author: Tomas Vanek <[email protected]>
Date:   Sun Oct 20 14:27:36 2019 +0200

    target/armv7m: use arch_info[i].value instead of allocated memory
    
    Change-Id: I9422cab484d0769404516947e16da1baa001a4e0
    Signed-off-by: Tomas Vanek <[email protected]>

diff --git a/src/target/armv7m.c b/src/target/armv7m.c
index ee13fbb..4c56c43 100644
--- a/src/target/armv7m.c
+++ b/src/target/armv7m.c
@@ -691,10 +691,7 @@ struct reg_cache *armv7m_build_reg_cache(struct target 
*target)
 
                reg_list[i].name = armv7m_regs[i].name;
                reg_list[i].size = armv7m_regs[i].bits;
-               size_t storage_size = DIV_ROUND_UP(armv7m_regs[i].bits, 8);
-               if (storage_size < 4)
-                       storage_size = 4;
-               reg_list[i].value = calloc(1, storage_size);
+               reg_list[i].value = arch_info[i].value;
                reg_list[i].dirty = false;
                reg_list[i].valid = false;
                reg_list[i].hidden = i == ARMV7M_PMSK_BPRI_FLTMSK_CTRL;
@@ -748,7 +745,6 @@ void armv7m_free_reg_cache(struct target *target)
 
                free(reg->feature);
                free(reg->reg_data_type);
-               free(reg->value);
        }
 
        free(cache->reg_list[0].arch_info);
diff --git a/src/target/cortex_m.c b/src/target/cortex_m.c
index 7f6186b..f1714d3 100644
--- a/src/target/cortex_m.c
+++ b/src/target/cortex_m.c
@@ -2044,7 +2044,6 @@ int cortex_m_examine(struct target *target)
                        for (idx = ARMV7M_NUM_CORE_REGS_NOFP;
                             idx < armv7m->arm.core_cache->num_regs;
                             idx++) {
-                               
free(armv7m->arm.core_cache->reg_list[idx].value);
                                
free(armv7m->arm.core_cache->reg_list[idx].feature);
                                
free(armv7m->arm.core_cache->reg_list[idx].reg_data_type);
                        }

-- 


_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to