Skip to content

Commit 6256d7f

Browse files
committed
Use crypt_zalloc instead of malloc+memset in crypt_init
1 parent fa6e244 commit 6256d7f

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

lib/setup.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -599,11 +599,9 @@ int crypt_init(struct crypt_device **cd, const char *device)
599599
log_dbg(NULL, "Running without O_CLOEXEC.");
600600
#endif
601601

602-
if (!(h = malloc(sizeof(struct crypt_device))))
602+
if (!(h = crypt_zalloc(sizeof(struct crypt_device))))
603603
return -ENOMEM;
604604

605-
memset(h, 0, sizeof(*h));
606-
607605
r = device_alloc(NULL, &h->device, device);
608606
if (r < 0) {
609607
free(h);

0 commit comments

Comments
 (0)