mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 08:43:03 +00:00
cex: fix counterexample leak
* src/counterexample.c (free_counterexample): New. Free counterexamples after printing.
This commit is contained in:
committed by
Akim Demaille
parent
b5e0351c3e
commit
86c45be582
@@ -70,14 +70,14 @@ list_get_end (gl_list_t list)
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
const derivation *d1;
|
derivation *d1;
|
||||||
const derivation *d2;
|
derivation *d2;
|
||||||
bool unifying;
|
bool unifying;
|
||||||
bool timeout;
|
bool timeout;
|
||||||
} counterexample;
|
} counterexample;
|
||||||
|
|
||||||
counterexample *
|
counterexample *
|
||||||
new_counterexample (const derivation *d1, const derivation *d2,
|
new_counterexample (derivation *d1, derivation *d2,
|
||||||
bool u, bool t)
|
bool u, bool t)
|
||||||
{
|
{
|
||||||
counterexample *res = xmalloc (sizeof (counterexample));
|
counterexample *res = xmalloc (sizeof (counterexample));
|
||||||
@@ -88,6 +88,14 @@ new_counterexample (const derivation *d1, const derivation *d2,
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
free_counterexample (counterexample *cex)
|
||||||
|
{
|
||||||
|
derivation_free (cex->d1);
|
||||||
|
derivation_free (cex->d2);
|
||||||
|
free (cex);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
print_counterexample (counterexample *cex)
|
print_counterexample (counterexample *cex)
|
||||||
{
|
{
|
||||||
@@ -1174,7 +1182,7 @@ counterexample_report (state_item_number itm1, state_item_number itm2,
|
|||||||
|
|
||||||
gl_list_free (shortest_path);
|
gl_list_free (shortest_path);
|
||||||
print_counterexample (cex);
|
print_counterexample (cex);
|
||||||
|
free_counterexample (cex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user