[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#3914) test030-relay frees already-freed memory



> I think I've spotted the problem; the fix is in HEAD.

Yes, the crash has moved again:-)

> However, I don't understand why valgrind is not detecting it.

Turn off sl_malloc.  I use the patch below.  (Used the ber
memory functions in the traceback, I should have mentioned that.)
Though slapd must be tested with sl_malloc enabled too.

Index: servers/slapd/sl_malloc.c
--- servers/slapd/sl_malloc.c	20 Jul 2005 17:26:46 -0000	1.34
+++ servers/slapd/sl_malloc.c	8 Aug 2005 19:52:00 -0000
@@ -252,4 +252,7 @@
 	int i, j;
 
+#ifdef PURIFY
+	return malloc(size);
+#endif
 	/* ber_set_option calls us like this */
 	if (!ctx) return ber_memalloc_x(size, NULL);
@@ -356,4 +359,7 @@
 		return slap_sl_malloc(size, ctx);
 
+#ifdef PURIFY
+	return realloc(ptr, size);
+#endif
 	/* Not our memory? */
 	if (!sh || ptr < sh->sh_base || ptr >= sh->sh_end) {
@@ -421,4 +427,9 @@
 	int i, inserted = 0;
 
+#ifdef PURIFY
+#	undef free /* do not use ch_free() */
+	free(ptr);
+	return;
+#endif
 	if (!sh || ptr < sh->sh_base || ptr >= sh->sh_end) {
 		ber_memfree_x(ptr, NULL);

-- 
Hallvard