]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib: Slightly simplify ad_alloc()
authorVolker Lendecke <vl@samba.org>
Tue, 25 Feb 2025 16:31:16 +0000 (17:31 +0100)
committerVolker Lendecke <vl@samba.org>
Thu, 27 Mar 2025 14:11:11 +0000 (14:11 +0000)
Use a struct initialization to avoid talloc_zero()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Mar 27 14:11:11 UTC 2025 on atb-devel-224

source3/lib/adouble.c

index e4b8b663c072cd108cce14066ebafd4f6dea691a..f8ae89d670c77d6bf2146a912e17a3f28e3a407d 100644 (file)
@@ -2510,22 +2510,23 @@ static struct adouble *ad_alloc(TALLOC_CTX *ctx,
                return NULL;
        }
 
-       ad = talloc_zero(ctx, struct adouble);
+       ad = talloc(ctx, struct adouble);
        if (ad == NULL) {
                rc = -1;
                goto exit;
        }
 
-       ad->ad_data = talloc_zero_array(ad, char, adsize);
+       *ad = (struct adouble){
+               .ad_type = type,
+               .ad_magic = AD_MAGIC,
+               .ad_version = AD_VERSION,
+               .ad_data = talloc_zero_array(ad, char, adsize),
+       };
        if (ad->ad_data == NULL) {
                rc = -1;
                goto exit;
        }
 
-       ad->ad_type = type;
-       ad->ad_magic = AD_MAGIC;
-       ad->ad_version = AD_VERSION;
-
        talloc_set_destructor(ad, adouble_destructor);
 
 exit: