From 99272331c60afa900852d996196b434ecd897287 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 18 Jul 2012 15:07:28 +0930 Subject: [PATCH] source3/passdb/py_passdb.c: don't steal from talloc_stackframe(). If you want a stack-style allocation, use talloc_stackframe(). If you don't, don't use it. In particular, talloc_stackframe() here is actually inside a pool, and stealing from pools is a bad idea. Signed-off-by: Rusty Russell --- source3/passdb/py_passdb.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/source3/passdb/py_passdb.c b/source3/passdb/py_passdb.c index 194a7d47a8f..39db9809338 100644 --- a/source3/passdb/py_passdb.c +++ b/source3/passdb/py_passdb.c @@ -560,34 +560,21 @@ static int py_samu_set_user_sid(PyObject *obj, PyObject *value, void *closure) static PyObject *py_samu_get_group_sid(PyObject *obj, void *closure) { struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj); - PyObject *py_group_sid; const struct dom_sid *group_sid; struct dom_sid *copy_group_sid; - TALLOC_CTX *mem_ctx; - - mem_ctx = talloc_stackframe(); - if (mem_ctx == NULL) { - PyErr_NoMemory(); - return NULL; - } group_sid = pdb_get_group_sid(sam_acct); if (group_sid == NULL) { Py_RETURN_NONE; } - copy_group_sid = dom_sid_dup(mem_ctx, group_sid); + copy_group_sid = dom_sid_dup(NULL, group_sid); if (copy_group_sid == NULL) { PyErr_NoMemory(); - talloc_free(mem_ctx); return NULL; } - py_group_sid = pytalloc_steal(dom_sid_Type, copy_group_sid); - - talloc_free(mem_ctx); - - return py_group_sid; + return pytalloc_steal(dom_sid_Type, copy_group_sid); } static int py_samu_set_group_sid(PyObject *obj, PyObject *value, void *closure) -- 2.11.4.GIT