This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] merge.c, don't pass null ptr to memcpy
On Thu, Jul 26, 2007 at 11:21:31AM -0700, msnyder@sonic.net wrote:
> > On Wed, Jul 25, 2007 at 02:51:08PM -0700, msnyder@sonic.net wrote:
> >> If alignment_power can't be zero, there's no use testing it.
> >> If it can, we still need to allocate a pad buffer (albeit of
> >> one byte), because it will be passed to bfd_bwrite and hence
> >> to memcpy.
> >
> > No, if alignment_power is zero, then pad will not be used because all
> > the pad lengths will be zero. In fact, I think we are allocating one
> > more byte than necessary since the pad lengths ought to be 0 to
> > (1 << alignment_power) - 1. I'll pre-approve a patch that changes
> > char *pad = NULL;
> > to
> > char *pad = "";
> > just to silence the warning.
>
> I thought of that, but I can't do it -- it gets passed to free at return.
Oops. OK, let's just leave this as is then.
--
Alan Modra
Australia Development Lab, IBM