CID 22527 Resource leak

This commit is contained in:
Enno Rehling 2015-11-04 19:20:34 +01:00
parent 4d1f2327fe
commit b6190b5193
1 changed files with 5 additions and 6 deletions

View File

@ -151,14 +151,13 @@ connection *get_borders(const region * r1, const region * r2)
connection *new_border(border_type * type, region * from, region * to)
{
connection *b = calloc(1, sizeof(struct connection));
connection *b, **bp = get_borders_i(from, to);
if (from && to) {
connection **bp = get_borders_i(from, to);
while (*bp)
assert(from && to);
while (*bp) {
bp = &(*bp)->next;
*bp = b;
}
*bp = b = calloc(1, sizeof(connection));
b->type = type;
b->from = from;
b->to = to;