Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 Jun 1997 09:14:29 -0400 (EDT)
From:      Tim Vanderhoek <tim@X2296>
To:        hoek@hwcn.org
Cc:        Bruce Evans <bde@zeta.org.au>, ac199@hwcn.org, freebsd-bugs@hub.freebsd.org, freebsd-gnats-submit@freebsd.org
Subject:   Re: bin/3451: vasprintf() doesn't work.
Message-ID:  <Pine.BSF.3.95q.970614091106.169B-100000@X2296>
In-Reply-To: <Pine.BSF.3.95q.970614085707.169A-100000@X2296>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 14 Jun 1997, Tim Vanderhoek wrote:

> On Sat, 14 Jun 1997, Bruce Evans wrote:
> 
> > >   	*str = realloc(h.base, (size_t)(h.size - h.left + 1));
> > >   	if (*str == NULL)	/* failed to realloc it to actual size */
> > > ! 		return (-1);
> > > ! 	(*str)[h.size - h.left] = '\0';
> > >   	return (ret);
> 
> Which, of course, points us to yet another error in the original
> vasprintf.c...  :)  The test to see if str is NULL is
> *str == NULL....

No, wait...  That should be *str == NULL...  Just ignore that
patch, and just put the free(h.base) in there...

Sheesh...  I should really look this stuff over before I send
it...  :-(

> ! 	if (str == NULL) {	/* failed to realloc it to actual size */
  !	if (*str == NULL) {	/* failed to realloc it to actual size */
^^^^^^^^^^^^^^^^^^^^^^^^^^

corrected.  again.

--
tIM...HOEk
optimization: The theory that making your code incomprehensible by using
              only one-letter variable names will make it run faster.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95q.970614091106.169B-100000>