Add a BIO_ADDR_clear function
[openssl.git] / crypto / bio / b_addr.c
index 20cb66dce0cc10d2237b8a2757568bd0edbad2b8..f1ff5fe37c2a7f7a35428be02b3a683034b6c335 100644 (file)
@@ -76,6 +76,7 @@
 BIO_ADDR *BIO_ADDR_new(void)
 {
     BIO_ADDR *ret = (BIO_ADDR *)OPENSSL_zalloc(sizeof(BIO_ADDR));
 BIO_ADDR *BIO_ADDR_new(void)
 {
     BIO_ADDR *ret = (BIO_ADDR *)OPENSSL_zalloc(sizeof(BIO_ADDR));
+    ret->sa.sa_family = AF_UNSPEC;
     return ret;
 }
 
     return ret;
 }
 
@@ -84,6 +85,12 @@ void BIO_ADDR_free(BIO_ADDR *ap)
     OPENSSL_free(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.
 /*
  * BIO_ADDR_make - non-public routine to fill a BIO_ADDR with the contents
  * of a struct sockaddr.