]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libsmb: Avoid an explicit ZERO_STRUCTP with calloc
authorVolker Lendecke <vl@samba.org>
Sat, 1 Apr 2023 09:55:10 +0000 (11:55 +0200)
committerVolker Lendecke <vl@samba.org>
Tue, 18 Apr 2023 14:58:36 +0000 (14:58 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/libsmb/libsmb_cache.c

index 2b32447807e7ab8d10f3040281f56247113cd97e..6b8a1ab4af9f3c63033755f2cf4097b792eb93ef 100644 (file)
@@ -55,14 +55,13 @@ SMBC_add_cached_server(SMBCCTX * context,
 {
        struct smbc_server_cache * srvcache = NULL;
 
-       if (!(srvcache = SMB_MALLOC_P(struct smbc_server_cache))) {
+       srvcache = SMB_CALLOC_ARRAY(struct smbc_server_cache, 1);
+       if (srvcache == NULL) {
                errno = ENOMEM;
                DEBUG(3, ("Not enough space for server cache allocation\n"));
                return 1;
        }
 
-       ZERO_STRUCTP(srvcache);
-
        srvcache->server = newsrv;
 
        srvcache->server_name = SMB_STRDUP(server);