[Top][All Lists]

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

FYI: HEAD: tryall_dlopen_module: improve string length computation

From: Ralf Wildenhues
Subject: FYI: HEAD: tryall_dlopen_module: improve string length computation
Date: Sat, 1 Sep 2007 10:10:06 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

Applied to HEAD: we were allocating too much memory.  No, Coverity did
not find that out.  Yes, valgrind starts complaining very loudly on
mdemo when I make it just one byte shorter than what it's now.

FWIW, with mdemo, valgrind on Linux/x86 does have quite a few false
positives inside libdl's dlopen and friends, presumably due to optimized
string functions accessing several bytes at once (so all my tests have
been comparing errors before and afterwards).


2007-09-01  Ralf Wildenhues  <address@hidden>

        * libltdl/ltdl.c (tryall_dlopen_module): Fix string length
        computation: do not allocate more than needed.

Index: libltdl/ltdl.c
RCS file: /cvsroot/libtool/libtool/libltdl/ltdl.c,v
retrieving revision 1.258
diff -u -r1.258 ltdl.c
--- libltdl/ltdl.c      30 Aug 2007 18:23:24 -0000      1.258
+++ libltdl/ltdl.c      1 Sep 2007 08:07:17 -0000
@@ -484,7 +484,7 @@
   /* Allocate memory, and combine DIRNAME and MODULENAME into it.
      The PREFIX (if any) is handled below.  */
-  filename  = MALLOC (char, dirname_len + 1 + filename_len + 1);
+  filename  = MALLOC (char, filename_len + 1);
   if (!filename)
     return 1;

reply via email to

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