[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/7] cex: fix counterexample leak
From: |
Vincent Imbimbo |
Subject: |
[PATCH 4/7] cex: fix counterexample leak |
Date: |
Thu, 21 May 2020 22:13:14 -0400 |
* src/counterexample.c:
(free_counterexample): New.
Free counterexamples after printing.
---
src/counterexample.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/counterexample.c b/src/counterexample.c
index 7e9c5656..0909652c 100644
--- a/src/counterexample.c
+++ b/src/counterexample.c
@@ -70,14 +70,14 @@ list_get_end (gl_list_t list)
typedef struct
{
- const derivation *d1;
- const derivation *d2;
+ derivation *d1;
+ derivation *d2;
bool unifying;
bool timeout;
} counterexample;
counterexample *
-new_counterexample (const derivation *d1, const derivation *d2,
+new_counterexample (derivation *d1, derivation *d2,
bool u, bool t)
{
counterexample *res = xmalloc (sizeof (counterexample));
@@ -88,6 +88,14 @@ new_counterexample (const derivation *d1, const derivation
*d2,
return res;
}
+void
+free_counterexample (counterexample *cex)
+{
+ derivation_free (cex->d1);
+ derivation_free (cex->d2);
+ free (cex);
+}
+
void
print_counterexample (counterexample *cex)
{
@@ -1174,7 +1182,7 @@ counterexample_report (state_item_number itm1,
state_item_number itm2,
gl_list_free (shortest_path);
print_counterexample (cex);
-
+ free_counterexample (cex);
}
void
--
2.20.1 (Apple Git-117)
- [PATCH 0/7] Fixing all cex leaks, Vincent Imbimbo, 2020/05/21
- [PATCH 1/7] cex: dervation reference counting, Vincent Imbimbo, 2020/05/21
- [PATCH 2/7] cex: fix parse state leaks, Vincent Imbimbo, 2020/05/21
- [PATCH 3/7] cex: fix lssi leaks, Vincent Imbimbo, 2020/05/21
- [PATCH 4/7] cex: fix counterexample leak,
Vincent Imbimbo <=
- [PATCH 5/7] cex: fix miscellaneous leaks, Vincent Imbimbo, 2020/05/21
- [PATCH 6/7] cex: fix bad reference counting, Vincent Imbimbo, 2020/05/21
- [PATCH 7/7] cex: replace state-item data structures, Vincent Imbimbo, 2020/05/21
- Re: [PATCH 0/7] Fixing all cex leaks, Akim Demaille, 2020/05/22