gdb_server: assert to avoid malloc(0)

Change-Id: I6ae3e007f4aa768f8bc64de78351750138f12e53
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/135
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
__archive__
Øyvind Harboe 2011-10-29 17:37:42 +02:00 committed by Øyvind Harboe
parent 252758b6a1
commit bab6db1fd9
1 changed files with 2 additions and 0 deletions

View File

@ -1061,6 +1061,8 @@ static int gdb_get_registers_packet(struct connection *connection,
reg_packet_size += reg_list[i]->size;
}
assert(reg_packet_size > 0);
reg_packet = malloc(DIV_ROUND_UP(reg_packet_size, 8) * 2);
reg_packet_p = reg_packet;