source3/passdb/py_passdb.c: don't steal from talloc_stackframe().
authorRusty Russell <rusty@rustcorp.com.au>
Wed, 18 Jul 2012 05:37:28 +0000 (15:07 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Wed, 18 Jul 2012 05:37:28 +0000 (15:07 +0930)
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 <rusty@rustcorp.com.au>
source3/passdb/py_passdb.c

index 194a7d47a8fdec043561f381d6b7876de7c44292..39db9809338eb2f5b94c77fc27bbbf25e642e6d5 100644 (file)
@@ -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)