]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
dns common: always check a talloc NULL.
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Wed, 24 Mar 2021 04:38:15 +0000 (17:38 +1300)
committerJeremy Allison <jra@samba.org>
Mon, 29 Mar 2021 23:20:37 +0000 (23:20 +0000)
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>
source4/dns_server/dnsserver_common.c

index bcb0d087faf665b9e43b5ee9302fc1d0e32f77e6..afd8df20194456b55dd819007f0c742e26497e2d 100644 (file)
@@ -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