Skip to content

Commit

Permalink
fix off-by-one error in make_id2insn. patch by Dang Hoang Vu
Browse files Browse the repository at this point in the history
  • Loading branch information
aquynh committed Jan 6, 2014
1 parent 1acfd0b commit 0b93e19
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static unsigned short *make_id2insn(insn_map *insns, unsigned int size)
unsigned short max_id = insns[size - 1].id;
unsigned int i;

unsigned short *cache = (unsigned short *)my_calloc(sizeof(*cache), max_id);
unsigned short *cache = (unsigned short *)my_calloc(sizeof(*cache), max_id + 1);

for (i = 1; i < size; i++)
cache[insns[i].id] = i;
Expand Down

0 comments on commit 0b93e19

Please sign in to comment.