Check for null pointer before decalaring register array.

This commit is contained in:
Gareth McMullin 2012-11-03 19:04:27 +13:00
parent 0990c2224c
commit 50b6c623d6
1 changed files with 2 additions and 2 deletions

View File

@ -84,8 +84,8 @@ gdb_main(void)
switch(pbuf[0]) {
/* Implementation of these is mandatory! */
case 'g': { /* 'g': Read general registers */
uint32_t arm_regs[cur_target->regs_size];
ERROR_IF_NO_TARGET();
uint32_t arm_regs[cur_target->regs_size];
target_regs_read(cur_target, (void*)arm_regs);
gdb_putpacket(hexify(pbuf, (void*)arm_regs, cur_target->regs_size), cur_target->regs_size * 2);
break;
@ -110,8 +110,8 @@ gdb_main(void)
break;
}
case 'G': { /* 'G XX': Write general registers */
uint32_t arm_regs[cur_target->regs_size];
ERROR_IF_NO_TARGET();
uint32_t arm_regs[cur_target->regs_size];
unhexify((void*)arm_regs, &pbuf[1], cur_target->regs_size);
target_regs_write(cur_target, arm_regs);
gdb_putpacket("OK", 2);