From: deraadt Date: Sun, 20 Apr 2014 14:03:55 +0000 (+0000) Subject: calloc() rather than malloc+memset X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d870f21cc21ecd367fd3228e389e07a619d36448;p=openbsd calloc() rather than malloc+memset --- 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; */