From: Matthias Kramm Date: Sat, 7 Feb 2009 19:50:35 +0000 (+0100) Subject: fixed a mem leak X-Git-Tag: release-0-9-0~152 X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=commitdiff_plain;h=5fd15b4a7f9211cf66afc1d03049517b29b277dd fixed a mem leak --- 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 -------------------------------------