asprintf/psignal.c change really correct?
Andreas Schwab
schwab@suse.de
Mon Jun 14 18:16:00 GMT 2004
Thorsten Kukuk <kukuk@suse.de> writes:
> Hi,
>
> We have the following change in current glibc CVS.
> I don't think that it is correct: if asprintf fails, we
> use fprintf or fwprintf. But than we access buf and try to
> print the content. But buf is undefined here.
This should work:
2004-06-14 Andreas Schwab <schwab@suse.de>
* stdio-common/psignal.c (psignal): Don't use buf when asprintf
failed.
--- stdio-common/psignal.c 03 Jun 2004 12:59:50 +0200 1.11
+++ stdio-common/psignal.c 14 Jun 2004 20:11:58 +0200
@@ -64,12 +64,14 @@ psignal (int sig, const char *s)
else
(void) fprintf (stderr, "%s%s%s\n", s, colon, _("Unknown signal"));
}
-
- if (_IO_fwide (stderr, 0) > 0)
- (void) __fwprintf (stderr, L"%s", buf);
else
- (void) fputs (buf, stderr);
+ {
+ if (_IO_fwide (stderr, 0) > 0)
+ (void) __fwprintf (stderr, L"%s", buf);
+ else
+ (void) fputs (buf, stderr);
- free (buf);
+ free (buf);
+ }
}
}
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, MaxfeldstraÃe 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
More information about the Libc-hacker
mailing list