From: Noel Power Date: Fri, 4 Sep 2020 02:11:08 +0000 (-0700) Subject: s3/libsmb: Cleanup, don't modify out params except on success X-Git-Tag: talloc-2.3.2~601 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e5fd57d6e578c9b46088ebe548e4d24ee61fd2ac;p=thirdparty%2Fsamba.git s3/libsmb: Cleanup, don't modify out params except on success All callers don't use out params on failure. Signed-off-by: Noel Power Reviewed-by: Jeremy Allison --- diff --git a/source3/libsmb/dsgetdcname.c b/source3/libsmb/dsgetdcname.c index 1f0ff66ac49..81d5f19afa2 100644 --- a/source3/libsmb/dsgetdcname.c +++ b/source3/libsmb/dsgetdcname.c @@ -449,9 +449,6 @@ static NTSTATUS discover_dc_netbios(TALLOC_CTX *mem_ctx, size_t count; static const char *resolve_order[] = { "lmhosts", "wins", "bcast", NULL }; - *returned_dclist = NULL; - *returned_count = 0; - if (flags & DS_PDC_REQUIRED) { name_type = NBT_NAME_PDC; } @@ -497,18 +494,17 @@ static NTSTATUS discover_dc_netbios(TALLOC_CTX *mem_ctx, } - *returned_dclist = dclist; - *returned_count = count; TALLOC_FREE(iplist); /* Paranoia in casting size_t -> int. */ - if (*returned_count < 0) { + if ((int)count < 0) { TALLOC_FREE(dclist); - *returned_dclist = NULL; - *returned_count = 0; return NT_STATUS_INVALID_PARAMETER; } + *returned_dclist = dclist; + *returned_count = count; + return NT_STATUS_OK; }