s3-passdb: Allocate talloc stackframe before calling pdb_get_group_sid()
authorAmitay Isaacs <amitay@gmail.com>
Fri, 26 Aug 2011 06:25:27 +0000 (16:25 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 26 Aug 2011 12:06:07 +0000 (14:06 +0200)
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
source3/passdb/py_passdb.c

index f1f138daa146b5db9002092ad9f3dfcd13b09ab5..f02230fd0192fa2551658c9e0919943bfaae515c 100644 (file)
@@ -567,16 +567,17 @@ static PyObject *py_samu_get_group_sid(PyObject *obj, void *closure)
        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;
        }
 
-       mem_ctx = talloc_new(NULL);
-       if (mem_ctx == NULL) {
-               PyErr_NoMemory();
-               return NULL;
-       }
        copy_group_sid = dom_sid_dup(mem_ctx, group_sid);
        if (copy_group_sid == NULL) {
                PyErr_NoMemory();