[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] cex: fix leaks
From: |
Vincent Imbimbo |
Subject: |
[PATCH] cex: fix leaks |
Date: |
Sun, 17 May 2020 09:59:39 -0400 |
* src/state-item.c: Various functions were using heap allocated locals and not
freeing them
Apple clang doesn't support leak sanitizer, so if this doesn't fix everything
I'll bite the bullet and install a newer llvm.
Also, I didn't touch the leak in complain_init_color. It looks like errstream
is getting leaked, which doesn't make sense since it's freed in complain_free.
---
src/state-item.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/state-item.c b/src/state-item.c
index 82496956..4a09e035 100644
--- a/src/state-item.c
+++ b/src/state-item.c
@@ -73,6 +73,7 @@ hash_pair_lookup (Hash_table *tab, int key)
hash_pair *hp = (hash_pair *) hash_lookup (tab, l);
if (!hp)
return NULL;
+ free (l);
return hp->l;
}
@@ -174,6 +175,7 @@ init_state_items (void)
}
state_item_map[nstates] = nstate_items;
+ bitsetv_free (production_items);
}
static size_t
@@ -193,7 +195,9 @@ state_sym_lookup (symbol_number sym, Hash_table *h)
{
state *s = xmalloc (sizeof (state));
s->accessing_symbol = sym;
- return hash_lookup (h, s);
+ state *res = hash_lookup (h, s);
+ free (s);
+ return res;
}
static void
@@ -234,6 +238,7 @@ init_trans (void)
}
}
}
+ free (transition_set);
}
}
@@ -306,7 +311,7 @@ init_prods (void)
bitset_set (si_revs[prod], j);
}
}
-
+ free (closure_map);
}
}
@@ -345,6 +350,7 @@ gen_lookaheads (void)
gl_list_add_first (queue, &state_items[sin]);
}
}
+ gl_list_free (queue);
}
}
--
2.20.1 (Apple Git-117)
- [PATCH] cex: fix leaks,
Vincent Imbimbo <=
- Re: [PATCH] cex: fix leaks, Akim Demaille, 2020/05/17
- Re: [PATCH] cex: fix leaks, Akim Demaille, 2020/05/17
- Re: [PATCH] cex: fix leaks, Akim Demaille, 2020/05/17
- Re: [PATCH] cex: fix leaks, Akim Demaille, 2020/05/18
- Re: [PATCH] cex: fix leaks, vmi6, 2020/05/18
- Re: [PATCH] cex: fix leaks, Akim Demaille, 2020/05/18
- Re: [PATCH] cex: fix leaks, Vincent Imbimbo, 2020/05/18
- Re: [PATCH] cex: fix leaks, Vincent Imbimbo, 2020/05/18
- Re: [PATCH] cex: fix leaks, Akim Demaille, 2020/05/19