OSDN Git Service

* emultempl/elf32.em (gld${EMULATION_NAME}_add_sysroot): Fix
authorAlexandre Oliva <aoliva@redhat.com>
Wed, 26 Feb 2003 00:56:14 +0000 (00:56 +0000)
committerAlexandre Oliva <aoliva@redhat.com>
Wed, 26 Feb 2003 00:56:14 +0000 (00:56 +0000)
memory allocation error.

ld/ChangeLog
ld/emultempl/elf32.em

index 3fa4fb4..0e78b31 100644 (file)
@@ -1,5 +1,8 @@
 2003-02-25  Alexandre Oliva  <aoliva@redhat.com>
 
+       * emultempl/elf32.em (gld${EMULATION_NAME}_add_sysroot): Fix
+       memory allocation error.
+
        * Makefile.am (ldmain.o): Define TOOLBINDIR.
        * Makefile.in: Rebuilt.
        * ldmain.c (ld_sysroot): Try to set from TOOLBINDIR too.
index c401fe2..839b7f4 100644 (file)
@@ -461,7 +461,7 @@ gld${EMULATION_NAME}_add_sysroot (path)
   if (path[i])
     colons++;
 
-  len = len + colons * strlen (ld_sysroot);
+  len = len + (colons + 1) * strlen (ld_sysroot);
   ret = xmalloc (len + 1);
   strcpy (ret, ld_sysroot);
   p = ret + strlen (ret);