* 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 3fa4fb429ba59967e915f69f275ff10b8531a63a..0e78b3123bcbbd6854be63dd455b4a6997f4f74f 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 c401fe210a700c986a943281dcf84b193f87ed9c..839b7f46431aaaf099d830a5438d11ce2455bb33 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);