diff options
author | Jeremy Allison <jra@samba.org> | 2015-03-03 17:02:47 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2015-03-08 18:24:07 +0100 |
commit | cc4e5481ea060db7f6d8a83619d859b2e002eb90 (patch) | |
tree | 24a5c06e6fc7b872559102a7ee3ac1b45e79e055 /source3/lib/errmap_unix.c | |
parent | 3289a5d84f73bf044e5767a6c47a3f7bf8357c08 (diff) | |
download | samba-cc4e5481ea060db7f6d8a83619d859b2e002eb90.tar.gz samba-cc4e5481ea060db7f6d8a83619d859b2e002eb90.tar.xz samba-cc4e5481ea060db7f6d8a83619d859b2e002eb90.zip |
lib: talloc: Allow destructors to reparent the object they're called on.
If a destructor returns failure (-1) when freeing a child, talloc
must then reparent the child.
Firstly it tries the owner of any reference, next the parent of the
current object calling _talloc_free_children_internal(), and finally
the null context in the last resort.
If a destructor reparented its own object, which can be a very
desirable thing to do (a destructor can make a decision it isn't
time to die yet, and as the parent may be going away it might
want to move itself to longer-term storage) then this new parent
gets overwritten by the existing reparenting logic.
This patch checks when freeing a child if it already reparented
itself, and if it did doesn't then overwrite the new parent.
Makes destructors more flexible.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
Diffstat (limited to 'source3/lib/errmap_unix.c')
0 files changed, 0 insertions, 0 deletions