[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
three line patch for ltdl.c memory reallocation problem
From: |
Dalibor Topic |
Subject: |
three line patch for ltdl.c memory reallocation problem |
Date: |
Thu, 31 Jul 2003 16:24:34 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.4) Gecko/20030624 |
Hi all,
in kaffe we have found a problem with libtool's realloc macro. Citing
the original bug report from Ito Kazumitsu in
http://www.kaffe.org/pipermail/kaffe/2003-June/042426.html :
--quote--
I have found a bug in libltdl/ltdl.c.
In argz_create_sep(), LT_DLMALLOC() allocates some memory.
And in argz_append(), LT_DLREALLOC() tries to expand it.
While LT_DLMALLOC() uses KMALLOC(), which does not call malloc(),
LT_DLREALLOC() uses realloc(), which requires that the memory
should have been allocated by malloc().
--quote--
KMALLOC is kaffe's internal malloc which references to a garbage
collector. So calling realloc on memory provided doesn't work properly.
See the referenced thread on the kaffe mailing list for more information.
The fix is to make LR_DLREALLOC use lt_dlrealloc instead of rpl_realloc.
lt_dlrealloc can be initialized to a sane function by the user.
Attached you'll find a patch by Jim Pick and Ito Kazumitsu. Below is the
corresponding ChangeLog entry.
2003-07-30 Jim Pick <address@hidden>,
Ito Kazumitsu <address@hidden>
* libltdl/ltdl.c:
(LT_DLREALLOC) use lt_dlrealloc instead of rpl_realloc.
cheers,
dalibor topic
More info on this patch:
http://www.kaffe.org/pipermail/kaffe/2003-June/042426.html
This should be merged upstream to libtool.
--- libltdl/ltdl.c.jim 2003-06-06 16:55:53.000000000 -0700
+++ libltdl/ltdl.c 2003-06-06 16:56:37.000000000 -0700
@@ -237,7 +237,10 @@
#else
#define LT_DLMALLOC(tp, n) ((tp *) lt_dlmalloc ((n) * sizeof(tp)))
+/*
#define LT_DLREALLOC(tp, p, n) ((tp *) rpl_realloc ((p), (n) * sizeof(tp)))
+*/
+#define LT_DLREALLOC(tp, p, n) ((tp *) lt_dlrealloc ((p), (n) * sizeof(tp)))
#define LT_DLFREE(p) \
LT_STMT_START { if (p) (p) = (lt_dlfree (p), (lt_ptr) 0); } LT_STMT_END
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- three line patch for ltdl.c memory reallocation problem,
Dalibor Topic <=