From 30d08223e65d4b610dbfa59e2486a41c37b3b8b1 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 24 Jan 2009 23:52:23 +0100 Subject: s3:idmap_tdb2: streamline idmap_tdb2_sid_to_id, adding tmp talloc ctx and removing a variable Michael --- source3/winbindd/idmap_tdb2.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'source3/winbindd/idmap_tdb2.c') diff --git a/source3/winbindd/idmap_tdb2.c b/source3/winbindd/idmap_tdb2.c index 8bde963c60..60b92c77ad 100644 --- a/source3/winbindd/idmap_tdb2.c +++ b/source3/winbindd/idmap_tdb2.c @@ -557,12 +557,13 @@ static NTSTATUS idmap_tdb2_sid_to_id(struct idmap_tdb2_context *ctx, struct id_m TDB_DATA data; char *keystr; unsigned long rec_id = 0; - NTSTATUS status; + TALLOC_CTX *tmp_ctx = talloc_stackframe(); - status = idmap_tdb2_open_db(); - NT_STATUS_NOT_OK_RETURN(status); + ret = idmap_tdb2_open_db(); + NT_STATUS_NOT_OK_RETURN(ret); - if ((keystr = sid_string_talloc(ctx, map->sid)) == NULL) { + keystr = sid_string_talloc(tmp_ctx, map->sid); + if (keystr == NULL) { DEBUG(0, ("Out of memory!\n")); ret = NT_STATUS_NO_MEMORY; goto done; @@ -571,7 +572,7 @@ static NTSTATUS idmap_tdb2_sid_to_id(struct idmap_tdb2_context *ctx, struct id_m DEBUG(10,("Fetching record %s\n", keystr)); /* Check if sid is present in database */ - data = dbwrap_fetch_bystring(idmap_tdb2, keystr, keystr); + data = dbwrap_fetch_bystring(idmap_tdb2, tmp_ctx, keystr); if (!data.dptr) { fstring idstr; @@ -626,7 +627,7 @@ static NTSTATUS idmap_tdb2_sid_to_id(struct idmap_tdb2_context *ctx, struct id_m } done: - talloc_free(keystr); + talloc_free(tmp_ctx); return ret; } -- cgit