Skip to content

Commit

Permalink
fix memory leaking bug found by valgrind
Browse files Browse the repository at this point in the history
  • Loading branch information
tumluliu committed Jan 5, 2016
1 parent e54f907 commit fbb3a76
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/graphassembler.c
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,12 @@ static ModeGraph buildPublicModeGraphFromCache(RoutingPlan *p) {
printf("[graphassembler.c::buildPublicModeGraphFromCache] Finish building public mode graph where there are %d vertices.\n", pGraph->vertex_count);
printf("[graphassembler.c::buildPublicModeGraphFromCache] Its first vertex id: %lld.\n", pGraph->vertices[0]->id);
#endif
free(fg->vertices);
free(fg);
for (i = 0; i < p->public_transit_mode_count; i++) {
free(pg[i]->vertices);
free(pg[i]);
}
return pGraph;
}

Expand Down Expand Up @@ -826,6 +832,9 @@ static void constructPublicModeGraph(RoutingPlan *p, Vertex *vertices,
#ifdef DEBUG
printf("[DEBUG][graphassembler.c::constructPublicModeGraph] done.\n");
#endif
for (int i = 0; i < publicSPcount; i++)
free(publicSPs[i]);
free(publicSPs);
}

static void constructSwitchPointSQL(RoutingPlan *p, char *switchSQL, int i) {
Expand Down

0 comments on commit fbb3a76

Please sign in to comment.