Skip to content

Commit

Permalink
grow to last_line since that is what we index by
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm1 committed Sep 18, 2012
1 parent f2438f3 commit f8b4834
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ext/rblineprof.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ profiler_hook(rb_event_t event, NODE *node, VALUE self, ID mid, VALUE klass)
}

/* grow the per-line array if necessary */
if (line >= sourcefile->nlines) {
if (sourcefile->last_line >= sourcefile->nlines) {
long prev_nlines = sourcefile->nlines;
sourcefile->nlines = line + 100;
sourcefile->nlines = sourcefile->last_line + 100;
sourcefile->lines = realloc(sourcefile->lines, sizeof(uint64_t) * sourcefile->nlines);
memset(sourcefile->lines + prev_nlines, 0, sizeof(uint64_t) * (sourcefile->nlines - prev_nlines));
}
Expand Down

0 comments on commit f8b4834

Please sign in to comment.