# New Ticket Created by Steve Peters
# Please include the string: [perl #43033]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=43033 >
free() assumes its passed a void *. mem_sys_free() should take the same type
of argument. Assuming that what you are passing to free() will never be
modified is a bit risky and may prevent various memory debugging aids from
working correctly.
Steve Peters
[EMAIL PROTECTED]
Index: src/gc/memory.c
===================================================================
--- src/gc/memory.c (revision 18626)
+++ src/gc/memory.c (working copy)
@@ -153,13 +153,13 @@
*/
void
-mem_sys_free(const void * const from)
+mem_sys_free(void * from)
{
#ifdef DETAIL_MEMORY_DEBUG
fprintf(stderr, "Freed %p\n", from);
#endif
if (from)
- free((void *)from);
+ free(from);
}
void
Index: include/parrot/memory.h
===================================================================
--- include/parrot/memory.h (revision 18626)
+++ include/parrot/memory.h (working copy)
@@ -19,7 +19,7 @@
PARROT_API void *mem__sys_realloc(void *, size_t);
#define mem_sys_realloc(x,y) (assert(x!=NULL), mem__sys_realloc(x,y))
-PARROT_API void mem_sys_free(const void * const);
+PARROT_API void mem_sys_free(void *);
void *mem__internal_allocate(size_t, const char *, int);
#define mem_internal_allocate(x) mem__internal_allocate(x, __FILE__, __LINE__)