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 /source4/lib/policy/gp_filesys.c | |
parent | 1f60aa8ec2e685517235aadbc11324d3b4a1a74d (diff) | |
download | samba-952bc3cad05467959ba5aa08682d754bd80d543b.tar.gz samba-952bc3cad05467959ba5aa08682d754bd80d543b.tar.xz samba-952bc3cad05467959ba5aa08682d754bd80d543b.zip |
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 'source4/lib/policy/gp_filesys.c')
-rw-r--r-- | source4/lib/policy/gp_filesys.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/source4/lib/policy/gp_filesys.c b/source4/lib/policy/gp_filesys.c index b6107fceae..a18c51341d 100644 --- a/source4/lib/policy/gp_filesys.c +++ b/source4/lib/policy/gp_filesys.c @@ -280,12 +280,18 @@ static NTSTATUS gp_get_files(struct smbcli_tree *tree, const char *share_path, /* Get local path by replacing backslashes with slashes */ local_rel_path = talloc_strdup(mem_ctx, list->files[i].rel_path); - NT_STATUS_HAVE_NO_MEMORY_AND_FREE(local_rel_path, mem_ctx); + if (local_rel_path == NULL) { + TALLOC_FREE(mem_ctx); + return NT_STATUS_NO_MEMORY; + } string_replace(local_rel_path, '\\', '/'); full_local_path = talloc_asprintf(mem_ctx, "%s%s", local_path, local_rel_path); - NT_STATUS_HAVE_NO_MEMORY_AND_FREE(full_local_path, mem_ctx); + if (full_local_path == NULL) { + TALLOC_FREE(mem_ctx); + return NT_STATUS_NO_MEMORY; + } /* If the entry is a directory, create it. */ if (list->files[i].is_directory == true) { @@ -301,7 +307,10 @@ static NTSTATUS gp_get_files(struct smbcli_tree *tree, const char *share_path, full_remote_path = talloc_asprintf(mem_ctx, "%s%s", share_path, list->files[i].rel_path); - NT_STATUS_HAVE_NO_MEMORY_AND_FREE(full_remote_path, mem_ctx); + if (full_remote_path == NULL) { + TALLOC_FREE(mem_ctx); + return NT_STATUS_NO_MEMORY; + } /* Get the file */ status = gp_get_file(tree, full_remote_path, full_local_path); @@ -340,15 +349,24 @@ NTSTATUS gp_fetch_gpt (struct gp_context *gp_ctx, struct gp_object *gpo, /* Get the remote path to copy from */ share_path = gp_get_share_path(mem_ctx, gpo->file_sys_path); - NT_STATUS_HAVE_NO_MEMORY_AND_FREE(share_path, mem_ctx); + if (share_path == NULL) { + TALLOC_FREE(mem_ctx); + return NT_STATUS_NO_MEMORY; + } /* Get the local path to copy to */ local_path = talloc_asprintf(gp_ctx, "%s/%s", gp_tmpdir(mem_ctx), gpo->name); - NT_STATUS_HAVE_NO_MEMORY_AND_FREE(local_path, mem_ctx); + if (local_path == NULL) { + TALLOC_FREE(mem_ctx); + return NT_STATUS_NO_MEMORY; + } /* Prepare the state structure */ state = talloc_zero(mem_ctx, struct gp_list_state); - NT_STATUS_HAVE_NO_MEMORY_AND_FREE(state, mem_ctx); + if (state == NULL) { + TALLOC_FREE(mem_ctx); + return NT_STATUS_NO_MEMORY; + } state->tree = gp_ctx->cli->tree; state->share_path = share_path; |