diff options
author | Garming Sam <garming@catalyst.net.nz> | 2014-02-13 17:51:11 +1300 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2014-03-05 16:33:21 +0100 |
commit | 952bc3cad05467959ba5aa08682d754bd80d543b (patch) | |
tree | ec59adb15fc07fbc6c50b9eeeeb17a7dada26905 /auth | |
parent | 1f60aa8ec2e685517235aadbc11324d3b4a1a74d (diff) | |
download | samba-952bc3cad05467959ba5aa08682d754bd80d543b.tar.gz |
Remove a number of NT_STATUS_HAVE_NO_MEMORY_AND_FREE macros from the codebase.
Following the current coding guidelines, it is considered bad practice to return from
within a macro and change control flow as they look like normal function calls.
Change-Id: I133eb5a699757ae57b87d3bd3ebbcf5b556b0268
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'auth')
-rw-r--r-- | auth/auth_sam_reply.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/auth/auth_sam_reply.c b/auth/auth_sam_reply.c index 00e04b941ed..4ede02cb9c5 100644 --- a/auth/auth_sam_reply.c +++ b/auth/auth_sam_reply.c @@ -154,7 +154,10 @@ NTSTATUS auth_convert_user_info_dc_saminfo3(TALLOC_CTX *mem_ctx, sam3->sids = talloc_array(sam, struct netr_SidAttr, user_info_dc->num_sids); - NT_STATUS_HAVE_NO_MEMORY_AND_FREE(sam3->sids, sam3); + if (sam3->sids == NULL) { + TALLOC_FREE(sam3); + return NT_STATUS_NO_MEMORY; + } /* We don't put the user and group SIDs in there */ for (i=2; i<user_info_dc->num_sids; i++) { @@ -162,7 +165,10 @@ NTSTATUS auth_convert_user_info_dc_saminfo3(TALLOC_CTX *mem_ctx, continue; } sam3->sids[sam3->sidcount].sid = dom_sid_dup(sam3->sids, &user_info_dc->sids[i]); - NT_STATUS_HAVE_NO_MEMORY_AND_FREE(sam3->sids[sam3->sidcount].sid, sam3); + if (sam3->sids[sam3->sidcount].sid == NULL) { + TALLOC_FREE(sam3); + return NT_STATUS_NO_MEMORY; + } sam3->sids[sam3->sidcount].attributes = SE_GROUP_MANDATORY | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_ENABLED; sam3->sidcount += 1; @@ -429,7 +435,10 @@ NTSTATUS make_user_info_dc_pac(TALLOC_CTX *mem_ctx, sidcount = user_info_dc->num_sids + pac_logon_info->res_groups.count; user_info_dc->sids = talloc_realloc(user_info_dc, user_info_dc->sids, struct dom_sid, sidcount); - NT_STATUS_HAVE_NO_MEMORY_AND_FREE(user_info_dc->sids, user_info_dc); + if (user_info_dc->sids == NULL) { + TALLOC_FREE(user_info_dc); + return NT_STATUS_NO_MEMORY; + } for (i = 0; pac_logon_info->res_group_dom_sid && i < pac_logon_info->res_groups.count; i++) { user_info_dc->sids[user_info_dc->num_sids] = *pac_logon_info->res_group_dom_sid; |