aboutsummaryrefslogtreecommitdiff
path: root/src/target/openrisc/or1k.c
diff options
context:
space:
mode:
authorPaul Fertser <fercerpav@gmail.com>2014-04-12 17:22:00 +0400
committerPaul Fertser <fercerpav@gmail.com>2014-04-14 18:18:13 +0000
commit151c31785a61a25ca06d48691c0dfd5a487f8721 (patch)
tree53fe6ae89574f278a4041360a2461716826026f8 /src/target/openrisc/or1k.c
parentcb1156421966f648cca0430f74553ebb9259312d (diff)
downloadriscv-openocd-151c31785a61a25ca06d48691c0dfd5a487f8721.zip
riscv-openocd-151c31785a61a25ca06d48691c0dfd5a487f8721.tar.gz
riscv-openocd-151c31785a61a25ca06d48691c0dfd5a487f8721.tar.bz2
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 <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2102 Tested-by: jenkins Reviewed-by: Salvador Arroyo <sarroyofdez@yahoo.es> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Diffstat (limited to 'src/target/openrisc/or1k.c')
-rw-r--r--src/target/openrisc/or1k.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/target/openrisc/or1k.c b/src/target/openrisc/or1k.c
index f26a016..5852fc7 100644
--- a/src/target/openrisc/or1k.c
+++ b/src/target/openrisc/or1k.c
@@ -513,7 +513,7 @@ static struct reg_cache *or1k_build_reg_cache(struct target *target)
struct or1k_common *or1k = target_to_or1k(target);
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((or1k->nb_regs) * sizeof(struct reg));
+ struct reg *reg_list = calloc(or1k->nb_regs, sizeof(struct reg));
struct or1k_core_reg *arch_info =
malloc((or1k->nb_regs) * sizeof(struct or1k_core_reg));
struct reg_feature *feature;