From b2ee40b5123ce466bfda67cdf63a540ae82a212e Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Wed, 24 Mar 2021 17:38:15 +1300 Subject: [PATCH] dns common: always check a talloc NULL. Also, since we're there, avoid sorting an array of 1 element. Signed-off-by: Douglas Bagnall Reviewed-by: Jeremy Allison --- source4/dns_server/dnsserver_common.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source4/dns_server/dnsserver_common.c b/source4/dns_server/dnsserver_common.c index bcb0d087faf..afd8df20194 100644 --- a/source4/dns_server/dnsserver_common.c +++ b/source4/dns_server/dnsserver_common.c @@ -989,12 +989,12 @@ WERROR dns_common_replace(struct ldb_context *samdb, * which might be used for the tombstone marker */ el->values = talloc_zero_array(el, struct ldb_val, MAX(1, rec_count)); - if (rec_count > 0) { - if (el->values == NULL) { - werr = WERR_NOT_ENOUGH_MEMORY; - goto exit; - } + if (el->values == NULL) { + werr = WERR_NOT_ENOUGH_MEMORY; + goto exit; + } + if (rec_count > 1) { /* * We store a sorted list with the high wType values first * that's what windows does. It also simplifies the -- 2.47.3