diff options
Diffstat (limited to 'e-util')
-rw-r--r-- | e-util/ChangeLog | 6 | ||||
-rw-r--r-- | e-util/e-memory.c | 17 |
2 files changed, 23 insertions, 0 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog index f66cd9af06..5de15f534f 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,9 @@ +2002-01-04 Jeffrey Stedfast <fejj@ximian.com> + + * e-memory.c (e_memchunk_clean): Prune free'd nodes from our free + list otherwise we'll end up re-using free'd memory blocks and + that's not a Good Thing (tm). + 2002-01-02 Jeffrey Stedfast <fejj@ximian.com> * md5-utils.h: Reverted. diff --git a/e-util/e-memory.c b/e-util/e-memory.c index 0dc865225d..108a627076 100644 --- a/e-util/e-memory.c +++ b/e-util/e-memory.c @@ -307,6 +307,23 @@ e_memchunk_clean(MemChunk *m) ci = hi; while (ci) { if (ci->count == m->blocksize) { + MemChunkFreeNode *prev = NULL; + + f = m->free; + while (f) { + if (tree_search (ci, (void *) f) == 0) { + /* prune this node from our free-node list */ + if (prev) + prev->next = f->next; + else + m->free = f->next; + } else { + prev = f; + } + + f = f->next; + } + g_ptr_array_remove_fast(m->blocks, ci->base); g_free(ci->base); } |