[PATCH] Replace unchecked malloc with xmalloc

Alan Modra amodra@gmail.com
Thu Apr 4 07:28:12 GMT 2024


On Thu, Apr 04, 2024 at 10:56:14AM +0530, Nandakumar Edamana wrote:
> diff --git a/binutils/dlltool.c b/binutils/dlltool.c
> index 066c99a4d4f..7a3d20f0af9 100644
> --- a/binutils/dlltool.c
> +++ b/binutils/dlltool.c
> @@ -876,7 +876,7 @@ dlltmp (char **buf, const char *fmt)
>  {
>    if (!*buf)
>      {
> -      *buf = malloc (strlen (tmp_prefix) + 64);
> +      *buf = xmalloc (strlen (tmp_prefix) + 64);
>        sprintf (*buf, fmt, tmp_prefix);
>      }
>    return *buf;
> 
> 
> This is the first time I submit a patch to binutils. Please guide me if I'm
> doing it wrong.

There was a problem when applying the patch, possibly caused by your
email app.
git am /tmp/nandakumar
warning: Patch sent with format=flowed; space at the end of lines might be lost.
Applying: Replace unchecked malloc with xmalloc
error: corrupt patch at line 6
Patch failed at 0001 Replace unchecked malloc with xmalloc

Since the patch was simple, I've applied it by hand and will commit it
for you.  Thanks for the fix!

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list