This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [PATCH] Include alloca.h for bfd


On Thu, Aug 23, 2001 at 05:47:16PM +0200, Thiemo Seufer wrote:
> 2001-08-23  Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
> 
> 	/bfd/ChangeLog
> 	* linker.c (_bfd_generic_link_add_archive_symbols): Replace alloca()
> 	by bfd_malloc().
> 
> 
> diff -BurpNX /bigdisk/src/binutils-exclude src-orig/bfd/linker.c src/bfd/linker.c
> --- src-orig/bfd/linker.c	Sat Aug 18 21:47:22 2001
> +++ src/bfd/linker.c	Thu Aug 23 17:14:45 2001
> @@ -1007,9 +1007,10 @@ _bfd_generic_link_add_archive_symbols (a
>  	     let's look for its import thunk */
>  	  if (info->pei386_auto_import)
>  	    {
> -	      char *buf = alloca (strlen (h->root.string) + 10);
> +	      char *buf = (char *) bfd_malloc (strlen (h->root.string) + 10);

You need to check return value - bfd_malloc can return NULL (but will set
bfd error).

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]