I: [PATCH] asprintf error handling fix

Ulrich Drepper drepper@redhat.com
Fri Dec 7 10:08:00 GMT 2001


"Dmitry V. Levin" <ldv@alt-linux.org> writes:

> I'm talking about already written software which rely on zeroing
> result_ptr.

There is no such software using glibc.  Changing this (which is
completely unnecessary) will create an incompatibility.  Newly
developed code might check only for the NULL pointer value and these
programs would then fail with older glibc versions.

> In this case no: former asprintf implementation in bad written program
> usually results to free(unitialized_pointer), while suggested feature will
> lead to free(0). See the difference?

Crap.  If the return value says "failed; don't use the result" you
cannot use the pointer value.  It's that easy.  The interface is
completely in line with other interfaces which behave the same.

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------



More information about the Libc-alpha mailing list