]> git.sur5r.net Git - openocd/blobdiff - src/target/mips32.c
mips32, dsp563xx: fix segfault on Gdb attach
[openocd] / src / target / mips32.c
index 11f39fea881d6b1c43944c8a97236314c38eddf8..7cf5477dcaefeea15141e8374919e71569987120 100644 (file)
@@ -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;