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/5381

-- gerrit

commit c549383b7b7dc713ff4dcfb2d2dfd6b3928d1623
Author: Tomas Vanek <[email protected]>
Date:   Fri Dec 20 23:50:26 2019 +0100

    target/etm: add check for calloc error
    
    and fix one more clang static analyzer warning.
    
    Change-Id: I17f03e318e1cf7617e7f753e7ca960552be547e5
    Signed-off-by: Tomas Vanek <[email protected]>

diff --git a/src/target/etm.c b/src/target/etm.c
index 5751348..d1cfe61 100644
--- a/src/target/etm.c
+++ b/src/target/etm.c
@@ -303,6 +303,11 @@ struct reg_cache *etm_build_reg_cache(struct target 
*target,
        reg_list = calloc(128, sizeof(struct reg));
        arch_info = calloc(128, sizeof(struct etm_reg));
 
+       if (reg_cache == NULL || reg_list == NULL || arch_info == NULL) {
+               LOG_ERROR("No memory");
+               goto fail;
+       }
+
        /* fill in values for the reg cache */
        reg_cache->name = "etm registers";
        reg_cache->next = NULL;
@@ -498,6 +503,7 @@ static int etm_read_reg_w_check(struct reg *reg,
        uint8_t *check_value, uint8_t *check_mask)
 {
        struct etm_reg *etm_reg = reg->arch_info;
+       assert(etm_reg);
        const struct etm_reg_info *r = etm_reg->reg_info;
        uint8_t reg_addr = r->addr & 0x7f;
        struct scan_field fields[3];

-- 


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

Reply via email to