From d870f21cc21ecd367fd3228e389e07a619d36448 Mon Sep 17 00:00:00 2001 From: deraadt Date: Sun, 20 Apr 2014 14:03:55 +0000 Subject: [PATCH] calloc() rather than malloc+memset --- lib/libssl/d1_lib.c | 4 ++-- lib/libssl/src/ssl/d1_lib.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/libssl/d1_lib.c b/lib/libssl/d1_lib.c index 0217b68928f..1dc0efc29ca 100644 --- a/lib/libssl/d1_lib.c +++ b/lib/libssl/d1_lib.c @@ -100,8 +100,8 @@ dtls1_new(SSL *s) if (!ssl3_new(s)) return (0); - if ((d1 = malloc(sizeof *d1)) == NULL) return (0); - memset(d1, 0, sizeof *d1); + if ((d1 = calloc(1, sizeof *d1)) == NULL) + return (0); /* d1->handshake_epoch=0; */ diff --git a/lib/libssl/src/ssl/d1_lib.c b/lib/libssl/src/ssl/d1_lib.c index 0217b68928f..1dc0efc29ca 100644 --- a/lib/libssl/src/ssl/d1_lib.c +++ b/lib/libssl/src/ssl/d1_lib.c @@ -100,8 +100,8 @@ dtls1_new(SSL *s) if (!ssl3_new(s)) return (0); - if ((d1 = malloc(sizeof *d1)) == NULL) return (0); - memset(d1, 0, sizeof *d1); + if ((d1 = calloc(1, sizeof *d1)) == NULL) + return (0); /* d1->handshake_epoch=0; */ -- 2.20.1