From: Douglas Bagnall Date: Mon, 29 Mar 2021 22:25:36 +0000 (+1300) Subject: dns scavenging: avoid a small memory leak X-Git-Tag: tevent-0.11.0~298 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=8f8eb92903c0bdafa98d88429d1580868d5605dc;p=thirdparty%2Fsamba.git dns scavenging: avoid a small memory leak Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/source4/dsdb/kcc/scavenge_dns_records.c b/source4/dsdb/kcc/scavenge_dns_records.c index 7100c61326d..0187d5abe66 100644 --- a/source4/dsdb/kcc/scavenge_dns_records.c +++ b/source4/dsdb/kcc/scavenge_dns_records.c @@ -396,9 +396,8 @@ NTSTATUS dns_delete_tombstones(TALLOC_CTX *mem_ctx, TALLOC_CTX *tmp_ctx = NULL; struct loadparm_context *lp_ctx = NULL; struct ldb_message_element *el = NULL; - struct dnsp_DnssrvRpcRecord *rec = NULL; + struct dnsp_DnssrvRpcRecord rec = {0}; const char *attrs[] = {"dnsRecord", "dNSTombstoned", NULL}; - rec = talloc_zero(mem_ctx, struct dnsp_DnssrvRpcRecord); current_time = unix_to_dns_timestamp(time(NULL)); @@ -458,7 +457,7 @@ NTSTATUS dns_delete_tombstones(TALLOC_CTX *mem_ctx, ndr_err = ndr_pull_struct_blob( el->values, tmp_ctx, - rec, + &rec, (ndr_pull_flags_fn_t)ndr_pull_dnsp_DnssrvRpcRecord); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { TALLOC_FREE(tmp_ctx); @@ -466,11 +465,11 @@ NTSTATUS dns_delete_tombstones(TALLOC_CTX *mem_ctx, return NT_STATUS_INTERNAL_ERROR; } - if (rec->wType != DNS_TYPE_TOMBSTONE) { + if (rec.wType != DNS_TYPE_TOMBSTONE) { continue; } - if (rec->data.EntombedTime > tombstone_nttime) { + if (rec.data.EntombedTime > tombstone_nttime) { continue; } /* @@ -489,8 +488,8 @@ NTSTATUS dns_delete_tombstones(TALLOC_CTX *mem_ctx, * 4383000 would be a fine threshold. We round up to * the crore-second (c. 2741CE) in honour of NTTIME. */ - if ((rec->data.EntombedTime < 10000000) && - (rec->data.EntombedTime > tombstone_hours)) { + if ((rec.data.EntombedTime < 10000000) && + (rec.data.EntombedTime > tombstone_hours)) { continue; }