1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

Remove unnecessary/incorrect talloc_steal() calls

The talloc_steal() in dsdb_enum_group_mem() is unnecessary, because
members was already allocated from the same mem_ctx.

The talloc_steal() in pdb_samba_dsdb_enum_aliasmem() is also unnecessary
for the same reason, but also incorrect, because it should be
dereferencing pmembers:

    talloc_steal(mem_ctx, *pmembers);

Furthermore, we should only assign to *pnum_members on success; otherwise
num_members is used uninitialized.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14264

Signed-off-by: Jonathon Reinhart <Jonathon.Reinhart@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Mar  5 18:40:16 UTC 2020 on sn-devel-184
This commit is contained in:
Jonathon Reinhart 2020-02-05 00:25:36 -05:00 committed by Andreas Schneider
parent 0dd2a27347
commit a4ed6ada50
2 changed files with 2 additions and 3 deletions

View File

@ -1752,9 +1752,8 @@ static NTSTATUS pdb_samba_dsdb_enum_aliasmem(struct pdb_methods *m,
}
status = dsdb_enum_group_mem(state->ldb, mem_ctx, dn, pmembers, &num_members);
*pnum_members = num_members;
if (NT_STATUS_IS_OK(status)) {
talloc_steal(mem_ctx, pmembers);
*pnum_members = num_members;
}
talloc_free(tmp_ctx);
return status;

View File

@ -495,7 +495,7 @@ NTSTATUS dsdb_enum_group_mem(struct ldb_context *ldb,
++j;
}
*members_out = talloc_steal(mem_ctx, members);
*members_out = members;
*pnum_members = j;
talloc_free(tmp_ctx);
return NT_STATUS_OK;