From 5fd15b4a7f9211cf66afc1d03049517b29b277dd Mon Sep 17 00:00:00 2001 From: Matthias Kramm Date: Sat, 7 Feb 2009 20:50:35 +0100 Subject: [PATCH] fixed a mem leak --- lib/as3/pool.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/as3/pool.c b/lib/as3/pool.c index c158811..d2963b0 100644 --- a/lib/as3/pool.c +++ b/lib/as3/pool.c @@ -828,16 +828,24 @@ static int compare_arrayentry(const void*_c1, const void*_c2) const array_entry_t*c2 = _c2; return c2->data - c1->data; } + +static void* nodup(const void*o) {return (void*)o;} + static void reshuffle_array(array_t*array) { qsort(array->d+1, array->num-1, sizeof(array->d[0]), compare_arrayentry); - dict_t*d = dict_new2(array->entry2pos->key_type); + type_t* old_type = array->entry2pos->key_type; + type_t old_type_nodup = *old_type; + old_type_nodup.dup = nodup; + dict_t*d = dict_new2(&old_type_nodup); dict_destroy_shallow(array->entry2pos); array->entry2pos = d; int t; for(t=0;tnum;t++) { dict_put(array->entry2pos, array->d[t].name, (void*)(ptroff_t)(t+1)); } + d->key_type = old_type; + } // ------------------------------- pool ------------------------------------- -- 1.7.10.4