[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: memory leak in dir-lookup found

From: Roland McGrath
Subject: Re: memory leak in dir-lookup found
Date: Sun, 1 Apr 2001 17:47:39 -0400 (EDT)

> I have added several convenience function and revised the source
> appropriately.  It also uses a new calling convention making
> not checking for errors difficult, however, this is at the cost
> of ABI incompatibility, however, I feel that this is worth it.

I don't think this is a useful interface change.  To my mind, your
interface makes it easier to fail to check for errors and more dangerous to
do so.  That is, you can just ignore the error_t return value and an
undetected error results in an uninitialized result parameter that the
careless code will then try to use with unpredictable results.  Conversely,
with the interface that returns the pointer, a caller will never ignore the
return value (because that's the only point of calling the function); a
careless caller will then dereference a null pointer, which will crash
quickly and clearly at that spot.  When the only possible reason for
failure is ENOMEM, there is no benefit in returning an error code.

I don't consider it a problem at all to change the ABI of libiohelp right now.
But this change is not a good one.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]