s3: Use talloc_stackframe in token_contains_name_in_list
authorVolker Lendecke <vl@samba.org>
Sat, 20 Oct 2012 05:20:39 +0000 (07:20 +0200)
committerVolker Lendecke <vl@samba.org>
Sat, 20 Oct 2012 05:21:26 +0000 (07:21 +0200)
source3/smbd/share_access.c

index 7087a985a979259423312ae994d409aaa260943c..aa3bd3965cbaf2690b412eb58d35441bab6459cc 100644 (file)
@@ -162,26 +162,21 @@ bool token_contains_name_in_list(const char *username,
                                 const struct security_token *token,
                                 const char **list)
 {
-       TALLOC_CTX *mem_ctx;
-
        if (list == NULL) {
                return False;
        }
-
-       if ( (mem_ctx = talloc_new(NULL)) == NULL ) {
-               smb_panic("talloc_new failed");
-       }
-
        while (*list != NULL) {
-               if (token_contains_name(mem_ctx, username, domain, sharename,
-                                       token, *list)) {
-                       TALLOC_FREE(mem_ctx);
-                       return True;
+               TALLOC_CTX *frame = talloc_stackframe();
+               bool ret;
+
+               ret = token_contains_name(frame, username, domain, sharename,
+                                         token, *list);
+               TALLOC_FREE(frame);
+               if (ret) {
+                       return true;
                }
                list += 1;
        }
-
-       TALLOC_FREE(mem_ctx);
        return False;
 }