mapping_ldb: fix memory leak in group enumeration
authorStefan Metzmacher <metze@samba.org>
Fri, 28 Mar 2008 14:06:56 +0000 (15:06 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 28 Mar 2008 18:48:42 +0000 (19:48 +0100)
metze
(This used to be commit 235c056a0ecbb70b21a2572d42c32067dd699988)

source3/groupdb/mapping_ldb.c

index 454fe467a97a39a5336600e1fbdf9b70a49aa824..6775f612e79bb419b40f60953852d3d18af52df0 100644 (file)
@@ -310,7 +310,7 @@ static bool enum_group_mapping(const DOM_SID *domsid, enum lsa_SidType sid_name_
        int i, ret;
        char *expr;
        fstring name;
-       struct ldb_result *res;
+       struct ldb_result *res = NULL;
        struct ldb_dn *basedn=NULL;
        TALLOC_CTX *tmp_ctx;
 
@@ -333,6 +333,7 @@ static bool enum_group_mapping(const DOM_SID *domsid, enum lsa_SidType sid_name_
        }
 
        ret = ldb_search(ldb, basedn, LDB_SCOPE_SUBTREE, expr, NULL, &res);
+       talloc_steal(tmp_ctx, res);
        if (ret != LDB_SUCCESS) goto failed;
 
        (*pp_rmap) = NULL;