From 151c31785a61a25ca06d48691c0dfd5a487f8721 Mon Sep 17 00:00:00 2001 From: Paul Fertser Date: Sat, 12 Apr 2014 17:22:00 +0400 Subject: mips32, dsp563xx: fix segfault on Gdb attach Since c6216201b249e6a97fcc085e413e3d34e0de6fb7 gdb target description generation support is enabled by default and it counts on checking "feature" pointer in reg_list. Both mips32 and dsp563xx neither used calloc nor explicitly set feature (as it was a newly introduced struct field). This patch changes all targets to use calloc for consistency. Change-Id: I9eceadef8b04aacb108e24ae23cb51ca3009586f Signed-off-by: Paul Fertser Reviewed-on: http://openocd.zylin.com/2102 Tested-by: jenkins Reviewed-by: Salvador Arroyo Reviewed-by: Spencer Oliver --- src/target/mips32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/target/mips32.c') diff --git a/src/target/mips32.c b/src/target/mips32.c index 11f39fe..7cf5477 100644 --- a/src/target/mips32.c +++ b/src/target/mips32.c @@ -252,7 +252,7 @@ struct reg_cache *mips32_build_reg_cache(struct target *target) int num_regs = MIPS32NUMCOREREGS; struct reg_cache **cache_p = register_get_last_cache_p(&target->reg_cache); struct reg_cache *cache = malloc(sizeof(struct reg_cache)); - struct reg *reg_list = malloc(sizeof(struct reg) * num_regs); + struct reg *reg_list = calloc(num_regs, sizeof(struct reg)); struct mips32_core_reg *arch_info = malloc(sizeof(struct mips32_core_reg) * num_regs); int i; -- cgit v1.1