[PATCH] Use talloc_autofree_context() to allocate global memory

Kamen Mazdrashki kamenim at samba.org
Mon Sep 8 06:22:30 MDT 2014


Hi,

Please find attached several patches to move global structure off of NULL
context into autofree context.
I have hit those while running unit tests in Openchange.

Strictly speaking, patch 0002 is not needed as the caller for this function
uses the memory returned and frees it immediately - we have only 1 caller
at the moment.
Nevertheless, we can't assume what the caller of
debug_list_class_names_and_levels()
is going to do and hence this patch. May be it will be good if we pass
memory context explicitly?

Please review.

A quick summary of changes:
 lib/ldb/common/ldb_modules.c |  6 +++---
 lib/param/loadparm.c         |  2 +-
 lib/tevent/tevent.c          |  2 +-
 lib/util/debug.c             | 12 +++++++++---
 4 files changed, 14 insertions(+), 8 deletions(-)

patches also pushed at:
https://github.com/kamenim/samba/commits/util-debug-use-autofree-context
(probing what will be the feedback for Github :)

Cheers,
kamen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-util-debug-Use-talloc_autofree_context-instead-of-NU.patch
Type: text/x-patch
Size: 1414 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20140908/33745580/attachment-0005.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-util-debug-debug_list_class_names_and_levels-alloc-m.patch
Type: text/x-patch
Size: 1143 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20140908/33745580/attachment-0006.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-ldb_modules-use-talloc-autofree-context-to-allocate-.patch
Type: text/x-patch
Size: 1511 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20140908/33745580/attachment-0007.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-tevent-Allocate-tevent_ops_list-structures-in-autofr.patch
Type: text/x-patch
Size: 871 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20140908/33745580/attachment-0008.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-loadparm-Allocate-bitmap-structures-in-autofree-cont.patch
Type: text/x-patch
Size: 949 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20140908/33745580/attachment-0009.bin>


More information about the samba-technical mailing list