mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 16:05:44 -07:00
Don't leak duplicate edges in Untangle
Untangle game descriptions are allowed to contain duplicate edges, and add234() can handle deduping them. However, when add234() reports that your newly-allocated edge is a duplicate, it's important to free it again.
This commit is contained in:
@ -420,7 +420,9 @@ static void addedge(tree234 *edges, int a, int b)
|
|||||||
e->a = min(a, b);
|
e->a = min(a, b);
|
||||||
e->b = max(a, b);
|
e->b = max(a, b);
|
||||||
|
|
||||||
add234(edges, e);
|
if (add234(edges, e) != e)
|
||||||
|
/* Duplicate edge. */
|
||||||
|
sfree(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool isedge(tree234 *edges, int a, int b)
|
static bool isedge(tree234 *edges, int a, int b)
|
||||||
|
Reference in New Issue
Block a user