]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Prefer calloc over malloc
authorRose <[email protected]>
Sun, 4 Jun 2023 17:41:02 +0000 (13:41 -0400)
committerDenis Ovsienko <[email protected]>
Tue, 2 Apr 2024 10:19:15 +0000 (11:19 +0100)
This makes the code cleaner anyway and avoids branching.

print-esp.c

index 560d3b948b0ec210417b449f1c9403bde72758c2..e8c1be4bb4acce264dc4a4f79224e69c788de636 100644 (file)
@@ -132,10 +132,7 @@ EVP_CIPHER_CTX_new(void)
 {
        EVP_CIPHER_CTX *ctx;
 
-       ctx = malloc(sizeof(*ctx));
-       if (ctx == NULL)
-               return (NULL);
-       memset(ctx, 0, sizeof(*ctx));
+       ctx = calloc(1, sizeof(*ctx));
        return (ctx);
 }