From owner-freebsd-bugs Sat Jun 14 06:15:22 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id GAA22586 for bugs-outgoing; Sat, 14 Jun 1997 06:15:22 -0700 (PDT) Received: from X2296 (ppp1616.on.sympatico.ca [206.172.249.80]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id GAA22579; Sat, 14 Jun 1997 06:15:18 -0700 (PDT) Received: from localhost (tim@localhost) by X2296 (8.7.6/8.7.3) with SMTP id JAA00261; Sat, 14 Jun 1997 09:14:30 -0400 (EDT) Date: Sat, 14 Jun 1997 09:14:29 -0400 (EDT) From: Tim Vanderhoek Reply-To: ac199@hwcn.org To: hoek@hwcn.org cc: Bruce Evans , ac199@hwcn.org, freebsd-bugs@hub.freebsd.org, freebsd-gnats-submit@freebsd.org Subject: Re: bin/3451: vasprintf() doesn't work. In-Reply-To: Message-ID: X-OS: FreeBSD 2.2 X-Mailer: Pine MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-bugs@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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.