[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Patch ping: 5 days without reply (was: Re: three line patch for ltdl.c m

From: Dalibor Topic
Subject: Patch ping: 5 days without reply (was: Re: three line patch for ltdl.c memory reallocation problem)
Date: Tue, 05 Aug 2003 11:29:42 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030312

Dalibor Topic wrote:
Hi all,

in kaffe we have found a problem with libtool's realloc macro. Citing the original bug report from Ito Kazumitsu in :

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

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.

dalibor topic


More info on this patch:

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 @@
#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


Libtool-patches mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]