]> git.sur5r.net Git - openocd/blobdiff - src/target/avr32_ap7k.c
mips32, dsp563xx: fix segfault on Gdb attach
[openocd] / src / target / avr32_ap7k.c
index 70af8c3ed5615db120bb8471febc7d4f5d3abbf7..e1812eccb049dfdd47d1a698ee24c817aac84c3b 100644 (file)
@@ -178,7 +178,7 @@ static struct reg_cache *avr32_build_reg_cache(struct target *target)
        struct avr32_ap7k_common *ap7k = target_to_ap7k(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(sizeof(struct reg) * num_regs);
+       struct reg *reg_list = calloc(num_regs, sizeof(struct reg));
        struct avr32_core_reg *arch_info =
                malloc(sizeof(struct avr32_core_reg) * num_regs);
        int i;