From: Noel Power Date: Thu, 10 Sep 2020 15:23:27 +0000 (+0100) Subject: s3/libsmb: cleanup discover_dc_dns, only set out params on success X-Git-Tag: talloc-2.3.2~529 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ed1e1e0b462917efbf46cda4fe644a5b0975515d;p=thirdparty%2Fsamba.git s3/libsmb: cleanup discover_dc_dns, only set out params on success Signed-off-by: Noel Power Reviewed-by: Jeremy Allison --- diff --git a/source3/libsmb/dsgetdcname.c b/source3/libsmb/dsgetdcname.c index a8d3c665bba..42db03ac52c 100644 --- a/source3/libsmb/dsgetdcname.c +++ b/source3/libsmb/dsgetdcname.c @@ -769,17 +769,20 @@ static NTSTATUS discover_dc_dns(TALLOC_CTX *mem_ctx, } } - *returned_dclist = dclist; - *return_count = (int)ret_count; - if (*return_count < 0) { + if ((int)ret_count < 0) { TALLOC_FREE(dcs); TALLOC_FREE(dclist); TALLOC_FREE(dns_lookups); return NT_STATUS_INTERNAL_ERROR; } + if (ret_count > 0) { + TALLOC_FREE(dcs); + TALLOC_FREE(dns_lookups); + *returned_dclist = dclist; + *return_count = (int)ret_count; return NT_STATUS_OK; }