target/etm: add check for calloc error
and fix one more clang static analyzer warning. Change-Id: I17f03e318e1cf7617e7f753e7ca960552be547e5 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/5381 Tested-by: jenkins Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
This commit is contained in:
parent
fe6bb7eac8
commit
af0dda8266
|
@ -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];
|
||||
|
|
Loading…
Reference in New Issue