From 7d1d48a2d0a08567f5c8e14d50d89a9b47c02f1d Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Fri, 5 Feb 2016 19:40:44 +0000 Subject: Add a BIO_ADDR_clear function Adds a new function BIO_ADDR_clear to reset a BIO_ADDR back to an unitialised state, and to set the family to AF_UNSPEC. Reviewed-by: Viktor Dukhovni --- crypto/bio/b_addr.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'crypto/bio/b_addr.c') diff --git a/crypto/bio/b_addr.c b/crypto/bio/b_addr.c index 20cb66dce0..f1ff5fe37c 100644 --- a/crypto/bio/b_addr.c +++ b/crypto/bio/b_addr.c @@ -76,6 +76,7 @@ BIO_ADDR *BIO_ADDR_new(void) { BIO_ADDR *ret = (BIO_ADDR *)OPENSSL_zalloc(sizeof(BIO_ADDR)); + ret->sa.sa_family = AF_UNSPEC; return ret; } @@ -84,6 +85,12 @@ void BIO_ADDR_free(BIO_ADDR *ap) OPENSSL_free(ap); } +void BIO_ADDR_clear(BIO_ADDR *ap) +{ + memset(ap, 0, sizeof(*ap)); + ap->sa.sa_family = AF_UNSPEC; +} + /* * BIO_ADDR_make - non-public routine to fill a BIO_ADDR with the contents * of a struct sockaddr. -- cgit v1.2.3