[RFC] [CTDB] Optimized memory handling.

Amitay Isaacs amitay at gmail.com
Fri Dec 15 08:39:38 UTC 2017


On Fri, Dec 15, 2017 at 7:20 PM, Swen Schillig <swen at vnet.ibm.com> wrote:
> On Fri, 2017-12-15 at 18:56 +1100, Amitay Isaacs via samba-technical
> wrote:
>> On Fri, Dec 15, 2017 at 5:16 PM, Swen Schillig via samba-technical
>> <samba-technical at lists.samba.org> wrote:
>> > On Thu, 2017-12-14 at 14:53 -0500, jim via samba-technical wrote:
>> > > You should not remove the error checks.
>> > > The errors won't happen but that is no reason not to keep the
>> > > checks.
>> > > The code might change in the future.
>> >
>> > I disagree, if a situation cannot happen, then there's no reason to
>> > check for it. If things change in future, then this can too.
>> >
>>
>> That's not correct.  As long as we are making any library calls (even
>> though it's tevent), you cannot assume it will always succeed.
>>
>> Amitay.
> No, not always, but here I can because the only possibility for those
> calls to fail is if there's no memory for a talloc...and that is cannot
> happen.
> But if you all insist, I can re-add.

You cannot assume what tevent library does in tevent_queue_create()
and tevent_create_immediate() calls.  Currently if might be only doing
talloc calls, but it might also make some system calls which can fail.

Looking at API documentation for tevent_queue_create(), it says it can
return NULL on error.  So we *must* check for it.

Amitay.



More information about the samba-technical mailing list