Prune free'd nodes from our free list otherwise we'll end up re-using

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).

svn path=/trunk/; revision=15250
This commit is contained in:
Jeffrey Stedfast
2002-01-05 00:03:05 +00:00
committed by Jeffrey Stedfast
parent 5dc56039e8
commit 5269a7d1e2
2 changed files with 23 additions and 0 deletions
+6
View File
@@ -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.
+17
View File
@@ -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);
}