From d2beff59ecd50ef2e77684bd0043c3d943a3b245 Mon Sep 17 00:00:00 2001 From: Garming Sam Date: Thu, 13 Feb 2014 18:08:56 +1300 Subject: Remove the remaining uses of the macro NT_STATUS_HAVE_NO_MEMORY_AND_FREE in 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: Id1b540cde127395a7b27385a7c0fe79f3a145c73 Signed-off-by: Garming Sam Reviewed-by: Jeremy Allison Reviewed-by: Andrew Bartlett Reviewed-by: Andreas Schneider --- source4/dsdb/kcc/kcc_topology.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'source4/dsdb/kcc') diff --git a/source4/dsdb/kcc/kcc_topology.c b/source4/dsdb/kcc/kcc_topology.c index 258b73610cc..2836199a69e 100644 --- a/source4/dsdb/kcc/kcc_topology.c +++ b/source4/dsdb/kcc/kcc_topology.c @@ -1003,8 +1003,10 @@ static NTSTATUS kcctpl_setup_graph(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, graph->edge_sets.data, struct kcctpl_multi_edge_set, graph->edge_sets.count + 1); - NT_STATUS_HAVE_NO_MEMORY_AND_FREE(new_data, - tmp_ctx); + if (new_data == NULL) { + TALLOC_FREE(tmp_ctx); + return NT_STATUS_NO_MEMORY; + } new_data[graph->edge_sets.count] = *edge_set; graph->edge_sets.data = new_data; graph->edge_sets.count++; @@ -2655,8 +2657,10 @@ static NTSTATUS kcctpl_get_spanning_tree_edges(struct kccsrv_service *service, vertex->edge_ids.data, struct GUID, vertex->edge_ids.count + 1); - NT_STATUS_HAVE_NO_MEMORY_AND_FREE(new_data, - tmp_ctx); + if (new_data == NULL) { + TALLOC_FREE(tmp_ctx); + return NT_STATUS_NO_MEMORY; + } new_data[vertex->edge_ids.count] = edge->id; vertex->edge_ids.data = new_data; vertex->edge_ids.count++; @@ -3136,8 +3140,10 @@ static NTSTATUS kcctpl_create_connection(struct kccsrv_service *service, keep_connections.data, struct GUID, keep_connections.count + 1); - NT_STATUS_HAVE_NO_MEMORY_AND_FREE(new_data, - tmp_ctx); + if (new_data == NULL) { + TALLOC_FREE(tmp_ctx); + return NT_STATUS_NO_MEMORY; + } new_data[keep_connections.count] = conn_guid; keep_connections.data = new_data; keep_connections.count++; -- cgit v1.2.1