[SSSD] [PATCH] fix early free of sdap_handle

Simo Sorce ssorce at redhat.com
Wed Apr 14 14:02:36 UTC 2010


On Wed, 14 Apr 2010 17:34:39 +0400
Eugene Indenbom <eindenbom at gmail.com> wrote:

> So it looks like you do not really believe that talloc destructors
> are always called and it's reliable to free memory in destructors. In
> my humble opinion if memory deallocation is controlled from
> destructor there is actually no actual need for talloc ownership.

If you always destroy a handle in a destructor then freeing in the
destructor is useless, you can simply make the destructor's parent the
memory context parent.
If you destroy conditionally in a destructor then you risk memory
leaks, unless you have other ways to make sure the context is freed.

> You suggestion of putting sdap_handle objects on destroy queue and 
> garbage collecting them later does not sound as better alternative.

Unfortunately nothing is ideal here. But I want to play safe and have
the memory hierarchy right rather then have special cases all over.
Every special case is a long term burden.

Simo.

-- 
Simo Sorce * Red Hat, Inc * New York



More information about the sssd-devel mailing list