[SSSD] [PATCH] fix early free of sdap_handle

Simo Sorce ssorce at redhat.com
Fri Apr 16 18:22:26 UTC 2010


On Fri, 16 Apr 2010 19:00:57 +0400
Eugene Indenbom <eindenbom at gmail.com> wrote:

> Looks equivalent to what you have written, a bit more verbose may be.

Ok in this case I think your patch is overkill.
All we really need is to use the destructor to do what it is meant for,
and just prevent freeing sdap_handle if we are recursing, and at the
same time use a lock so that only one sdap_handle_release (the
""outermost"" does the job).

Attached find a patch.

Note that the patch still includes my old changes to avoid freeing
ctx->gsh, they are *not* necessary, but I think they are good hygiene
anyway so I left them in.

The only changes really necessary are the ones to add the 2 booleans to
sdap_handle in sdap.h and the changes to sdap_handle_destructor() and
sdap_handle_release() in sdap_async.c

These changes are much less invasive than the patch you propose and it
looks to me they provide for the same outcome.

Of course comments are welcome.

If someone want to see this core change split from the other cosmetic
changes to move freeing ctx->gsh and friends, let me know.

Simo.

-- 
Simo Sorce * Red Hat, Inc * New York
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Avoid-freeing-sdap_handle-too-early.patch
Type: text/x-patch
Size: 19188 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/sssd-devel/attachments/20100416/d33a63b6/attachment.bin>


More information about the sssd-devel mailing list