1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

dns common: always check a talloc NULL.

Also, since we're there, avoid sorting an array of 1 element.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Douglas Bagnall 2021-03-24 17:38:15 +13:00 committed by Jeremy Allison
parent 1432314f5c
commit b2ee40b512

View File

@ -989,12 +989,12 @@ WERROR dns_common_replace(struct ldb_context *samdb,
* which might be used for the tombstone marker * which might be used for the tombstone marker
*/ */
el->values = talloc_zero_array(el, struct ldb_val, MAX(1, rec_count)); el->values = talloc_zero_array(el, struct ldb_val, MAX(1, rec_count));
if (rec_count > 0) { if (el->values == NULL) {
if (el->values == NULL) { werr = WERR_NOT_ENOUGH_MEMORY;
werr = WERR_NOT_ENOUGH_MEMORY; goto exit;
goto exit; }
}
if (rec_count > 1) {
/* /*
* We store a sorted list with the high wType values first * We store a sorted list with the high wType values first
* that's what windows does. It also simplifies the * that's what windows does. It also simplifies the