summaryrefslogtreecommitdiffhomepage
path: root/ir/be/beprefalloc.c
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2014-04-25 16:46:10 +0200
committerMatthias Braun <matze@braunis.de>2014-04-25 16:59:08 +0200
commit9e4ad1fbc2938724444652953a99cc631eaf2596 (patch)
treee315727980b95b44ef051ffada4d71d4fb97592c /ir/be/beprefalloc.c
parenta727f98b88aaa7588241c9e1e910ed780f4d030d (diff)
fix a bunch of memory leaks reported by coverity
Diffstat (limited to 'ir/be/beprefalloc.c')
-rw-r--r--ir/be/beprefalloc.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/ir/be/beprefalloc.c b/ir/be/beprefalloc.c
index cd3ea17..b77e334 100644
--- a/ir/be/beprefalloc.c
+++ b/ir/be/beprefalloc.c
@@ -1024,6 +1024,8 @@ static void solve_lpp(ir_nodeset_t *live_nodes, ir_node *node,
assert(lpp_vars[l*n_regs+r] > 0);
}
}
+ free(forbidden_edges);
+
/* add constraints */
for (unsigned l = 0; l < n_regs; ++l) {
/* only 1 destination per register */
@@ -1054,7 +1056,11 @@ static void solve_lpp(ir_nodeset_t *live_nodes, ir_node *node,
}
}
- lpp_dump_plain(lpp, fopen("lppdump.txt", "w"));
+ FILE *out = fopen("lppdump.txt", "w");
+ if (out == NULL)
+ panic("Couldn't open lppdump.txt");
+ lpp_dump_plain(lpp, out);
+ fclose(out);
/* solve lpp */
lpp_solve(lpp, be_options.ilp_server, be_options.ilp_solver);
@@ -1077,6 +1083,7 @@ static void solve_lpp(ir_nodeset_t *live_nodes, ir_node *node,
assert(dest_reg != (unsigned)-1);
assignment[dest_reg] = l;
}
+ free(lpp_vars);
fprintf(stderr, "Assignment: ");
for (unsigned l = 0; l < n_regs; ++l) {