[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: |
Fri, 13 Apr 2001 15:24:45 -0400 (EDT) |
> > 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.
>
> Would you accept this change: same functions except, they return a
> struct iouser *? E.g.
>
> struct iouser *iohelp_create_simple_iouser (uid_t uid, gid_t gid);
Yes.