Skip to content

Commit

Permalink
Fix realloc misussage in r_bp
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Jun 19, 2018
1 parent cd16629 commit d22fc94
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion libr/bp/bp.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ R_API int r_bp_set_trace_all(RBreakpoint *bp, int set) {
}
return true;
}

// TODO: deprecate
R_API int r_bp_list(RBreakpoint *bp, int rad) {
int n = 0;
Expand Down Expand Up @@ -344,7 +345,12 @@ R_API RBreakpointItem *r_bp_item_new (RBreakpoint *bp) {
}
/* allocate new slot */
bp->bps_idx_count += 16; // alocate space for 16 more bps
bp->bps_idx = realloc (bp->bps_idx, bp->bps_idx_count * sizeof(RBreakpointItem*));
RBreakpointItem **newbps = realloc (bp->bps_idx, bp->bps_idx_count * sizeof (RBreakpointItem*));
if (newbps) {
bp->bps_idx = newbps;
} else {
bp->bps_idx_count -= 16; // alocate space for 16 more bps
}
for (j = i; j < bp->bps_idx_count; j++) {
bp->bps_idx[j] = NULL;
}
Expand Down

0 comments on commit d22fc94

Please sign in to comment.