From f168fac54c971286940f7471e45fa2c6eac76142 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 8 Jan 2008 21:51:07 +0100 Subject: Don't leak data.dptr on error path. Michael (This used to be commit d14de0692c623ff07dada45a3d7bec03ceca2b7e) --- source3/groupdb/mapping_tdb.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'source3/groupdb/mapping_tdb.c') diff --git a/source3/groupdb/mapping_tdb.c b/source3/groupdb/mapping_tdb.c index cf9f9058af..9adde40426 100644 --- a/source3/groupdb/mapping_tdb.c +++ b/source3/groupdb/mapping_tdb.c @@ -394,6 +394,7 @@ static NTSTATUS one_alias_membership(const DOM_SID *member, char *string_sid; TDB_DATA dbuf; const char *p; + NTSTATUS status; TALLOC_CTX *frame; slprintf(key, sizeof(key), "%s%s", MEMBEROF_PREFIX, @@ -414,14 +415,15 @@ static NTSTATUS one_alias_membership(const DOM_SID *member, continue; if (!add_sid_to_array_unique(NULL, &alias, sids, num)) { - TALLOC_FREE(frame); - return NT_STATUS_NO_MEMORY; + status = NT_STATUS_NO_MEMORY; + goto done; } } +done: TALLOC_FREE(frame); SAFE_FREE(dbuf.dptr); - return NT_STATUS_OK; + return status; } static NTSTATUS alias_memberships(const DOM_SID *members, size_t num_members, -- cgit From f3603d5a5ab878d45b67bf0f33e2beca50d0af2d Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 9 Jan 2008 00:11:31 +0100 Subject: Convert add_sid_to_array() add_sid_to_array_unique() to return NTSTATUS. Michael (This used to be commit 6b2b9a60ef857ec31da5fea631535205fbdede4a) --- source3/groupdb/mapping_tdb.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'source3/groupdb/mapping_tdb.c') diff --git a/source3/groupdb/mapping_tdb.c b/source3/groupdb/mapping_tdb.c index 9adde40426..21a4f95383 100644 --- a/source3/groupdb/mapping_tdb.c +++ b/source3/groupdb/mapping_tdb.c @@ -414,8 +414,8 @@ static NTSTATUS one_alias_membership(const DOM_SID *member, if (!string_to_sid(&alias, string_sid)) continue; - if (!add_sid_to_array_unique(NULL, &alias, sids, num)) { - status = NT_STATUS_NO_MEMORY; + status= add_sid_to_array_unique(NULL, &alias, sids, num); + if (!NT_STATUS_IS_OK(status)) { goto done; } } @@ -560,7 +560,10 @@ static int collect_aliasmem(TDB_CONTEXT *tdb_ctx, TDB_DATA key, TDB_DATA data, if (!string_to_sid(&member, member_string)) continue; - if (!add_sid_to_array(NULL, &member, closure->sids, closure->num)) { + if (!NT_STATUS_IS_OK(add_sid_to_array(NULL, &member, + closure->sids, + closure->num))) + { /* talloc fail. */ break; } -- cgit From ddabc2b00c8b01dfd1c019e2d3a946a766fe4e51 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 15 Jan 2008 15:09:13 -0800 Subject: Fix "status used uninitialized" warnings. Jeremy. (This used to be commit e57856fff2ef86481ac6770c7d010a26666d8bdd) --- source3/groupdb/mapping_tdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/groupdb/mapping_tdb.c') diff --git a/source3/groupdb/mapping_tdb.c b/source3/groupdb/mapping_tdb.c index 21a4f95383..67e377c338 100644 --- a/source3/groupdb/mapping_tdb.c +++ b/source3/groupdb/mapping_tdb.c @@ -394,7 +394,7 @@ static NTSTATUS one_alias_membership(const DOM_SID *member, char *string_sid; TDB_DATA dbuf; const char *p; - NTSTATUS status; + NTSTATUS status = NT_STATUS_OK; TALLOC_CTX *frame; slprintf(key, sizeof(key), "%s%s", MEMBEROF_PREFIX, -- cgit