[cvs] bogofilter/src datastore_sqlite.c,1.20,1.21
Matthias Andree
matthias.andree at gmx.de
Tue Mar 15 13:49:48 CET 2005
Matthias Andree <matthias.andree at gmx.de> writes:
> David Relson <relson at osagesoftware.com> writes:
>
>> When storage is allocated with xstrdup or xmalloc, it _must_ be freed
>> with _xfree_ in order for memdebug to work!!!
>
> Then memdebug is the wrong approach or has implementation flaws; in
[...]
> It should be possible to use memdebug.h to also detour malloc, calloc,
> realloc and free to the debugging functions.
How about this? Untested.
Index: memdebug.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/memdebug.c,v
retrieving revision 1.17
diff -u -r1.17 memdebug.c
--- memdebug.c 12 Mar 2005 04:23:36 -0000 1.17
+++ memdebug.c 15 Mar 2005 12:47:56 -0000
@@ -100,6 +100,11 @@
return;
}
+#undef malloc
+#undef calloc
+#undef realloc
+#undef free
+
void *
md_malloc(size_t size)
{
Index: memdebug.h
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/memdebug.h,v
retrieving revision 1.3
diff -u -r1.3 memdebug.h
--- memdebug.h 1 Jan 2004 18:19:01 -0000 1.3
+++ memdebug.h 15 Mar 2005 12:47:56 -0000
@@ -29,4 +29,9 @@
#define bf_realloc md_realloc
#define bf_free md_free
+#define malloc(a) md_malloc((a))
+#define calloc(a,b) md_calloc((a),(b))
+#define realloc(a,b) md_realloc((a),(b))
+#define free(a) md_free((a))
+
#endif /* MEMDEBUG_H */
--
Matthias Andree
_______________________________________________
Bogofilter-dev mailing list
Bogofilter-dev at bogofilter.org
http://www.bogofilter.org/mailman/listinfo/bogofilter-dev
More information about the bogofilter-dev
mailing list