From: Volker Lendecke Date: Wed, 17 Jun 2026 06:02:35 +0000 (+0200) Subject: dns_server: Use talloc_realloc_zero() to avoid explicit ZERO_STRUCT() X-Git-Tag: samba-4.25.0rc1~79 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9d48ea232d7bde8ec4adfdc93c2d4d5a9c42168;p=thirdparty%2Fsamba.git dns_server: Use talloc_realloc_zero() to avoid explicit ZERO_STRUCT() Signed-off-by: Volker Lendecke Reviewed-by: Anoop C S --- diff --git a/source4/dns_server/dns_query.c b/source4/dns_server/dns_query.c index d0d733bb5b9..872eceab2f3 100644 --- a/source4/dns_server/dns_query.c +++ b/source4/dns_server/dns_query.c @@ -62,13 +62,11 @@ static WERROR add_response_rr(const char *name, /* * "ans" is always non-NULL and thus its own talloc context */ - ans = talloc_realloc(ans, ans, struct dns_res_rec, ai+1); + ans = talloc_realloc_zero(ans, ans, struct dns_res_rec, ai+1); if (ans == NULL) { return WERR_NOT_ENOUGH_MEMORY; } - ZERO_STRUCT(ans[ai]); - switch (rec->wType) { case DNS_QTYPE_CNAME: ans[ai].rdata.cname_record = talloc_strdup(ans, rec->data.cname); @@ -155,13 +153,11 @@ static WERROR add_dns_res_rec(struct dns_res_rec **pdst, return WERR_BUFFER_OVERFLOW; } - dst = talloc_realloc(dst, dst, struct dns_res_rec, di+1); + dst = talloc_realloc_zero(dst, dst, struct dns_res_rec, di+1); if (dst == NULL) { return WERR_NOT_ENOUGH_MEMORY; } - ZERO_STRUCT(dst[di]); - dst[di] = (struct dns_res_rec) { .name = talloc_strdup(dst, src->name), .rr_type = src->rr_type,