summaryrefslogtreecommitdiff
path: root/libgpo
diff options
context:
space:
mode:
authorGarming Sam <garming@catalyst.net.nz>2014-02-13 17:51:11 +1300
committerAndreas Schneider <asn@cryptomilk.org>2014-03-05 16:33:21 +0100
commit952bc3cad05467959ba5aa08682d754bd80d543b (patch)
treeec59adb15fc07fbc6c50b9eeeeb17a7dada26905 /libgpo
parent1f60aa8ec2e685517235aadbc11324d3b4a1a74d (diff)
downloadsamba-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 'libgpo')
-rw-r--r--libgpo/gpo_util.c40
1 files changed, 32 insertions, 8 deletions
diff --git a/libgpo/gpo_util.c b/libgpo/gpo_util.c
index b846d3d8649..5b801c4b086 100644
--- a/libgpo/gpo_util.c
+++ b/libgpo/gpo_util.c
@@ -726,34 +726,58 @@ NTSTATUS gpo_copy(TALLOC_CTX *mem_ctx,
gpo->version = gpo_src->version;
gpo->ds_path = talloc_strdup(gpo, gpo_src->ds_path);
- NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpo->ds_path, gpo);
+ if (gpo->ds_path == NULL) {
+ TALLOC_FREE(gpo);
+ return NT_STATUS_NO_MEMORY;
+ }
gpo->file_sys_path = talloc_strdup(gpo, gpo_src->file_sys_path);
- NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpo->file_sys_path, gpo);
+ if (gpo->file_sys_path == NULL) {
+ TALLOC_FREE(gpo);
+ return NT_STATUS_NO_MEMORY;
+ }
gpo->display_name = talloc_strdup(gpo, gpo_src->display_name);
- NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpo->display_name, gpo);
+ if (gpo->display_name == NULL) {
+ TALLOC_FREE(gpo);
+ return NT_STATUS_NO_MEMORY;
+ }
gpo->name = talloc_strdup(gpo, gpo_src->name);
- NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpo->name, gpo);
+ if (gpo->name == NULL) {
+ TALLOC_FREE(gpo);
+ return NT_STATUS_NO_MEMORY;
+ }
gpo->link = talloc_strdup(gpo, gpo_src->link);
- NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpo->link, gpo);
+ if (gpo->link == NULL) {
+ TALLOC_FREE(gpo);
+ return NT_STATUS_NO_MEMORY;
+ }
gpo->link_type = gpo_src->link_type;
if (gpo_src->user_extensions) {
gpo->user_extensions = talloc_strdup(gpo, gpo_src->user_extensions);
- NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpo->user_extensions, gpo);
+ if (gpo->user_extensions == NULL) {
+ TALLOC_FREE(gpo);
+ return NT_STATUS_NO_MEMORY;
+ }
}
if (gpo_src->machine_extensions) {
gpo->machine_extensions = talloc_strdup(gpo, gpo_src->machine_extensions);
- NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpo->machine_extensions, gpo);
+ if (gpo->machine_extensions == NULL) {
+ TALLOC_FREE(gpo);
+ return NT_STATUS_NO_MEMORY;
+ }
}
gpo->security_descriptor = dup_sec_desc(gpo, gpo_src->security_descriptor);
- NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpo->security_descriptor, gpo);
+ if (gpo->security_descriptor == NULL) {
+ TALLOC_FREE(gpo);
+ return NT_STATUS_NO_MEMORY;
+ }
gpo->next = gpo->prev = NULL;