Skip to content

Commit

Permalink
Fixed malloc bug in lap_collect_traces
Browse files Browse the repository at this point in the history
  • Loading branch information
Siyuan Shen committed Nov 20, 2023
1 parent c04fa8c commit d875e4f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/liballprof2/tracer_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ static void lap_collect_traces(void) {
PMPI_Comm_size(MPI_COMM_WORLD, &comm_size);
int trace_size = ftell(lap_fptr);
fseek(lap_fptr, 0, SEEK_SET);
int* trace_sizes = malloc(comm_size);
int* trace_sizes = malloc(comm_size * sizeof(int));
if (trace_sizes == NULL) {
fprintf(stderr, "lap2 ran out of memory when collecting traces :(\n");
return;
Expand Down Expand Up @@ -130,4 +130,4 @@ int main(int argc, char** argv) {
}
lap_collect_traces();
MPI_Finalize();
}
}

0 comments on commit d875e4f

Please sign in to comment.