Switch some easy SSL fields to UniquePtr.
Change-Id: I982ecda5a19187708b15e8572e6d0000c22ed87c
Reviewed-on: https://boringssl-review.googlesource.com/29590
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/ssl/ssl_buffer.cc b/ssl/ssl_buffer.cc
index da1de93..72647a4 100644
--- a/ssl/ssl_buffer.cc
+++ b/ssl/ssl_buffer.cc
@@ -113,7 +113,8 @@
}
// Read a single packet from |ssl->rbio|. |buf->cap()| must fit in an int.
- int ret = BIO_read(ssl->rbio, buf->data(), static_cast<int>(buf->cap()));
+ int ret =
+ BIO_read(ssl->rbio.get(), buf->data(), static_cast<int>(buf->cap()));
if (ret <= 0) {
ssl->s3->rwstate = SSL_READING;
return ret;
@@ -134,7 +135,7 @@
while (buf->size() < len) {
// The amount of data to read is bounded by |buf->cap|, which must fit in an
// int.
- int ret = BIO_read(ssl->rbio, buf->data() + buf->size(),
+ int ret = BIO_read(ssl->rbio.get(), buf->data() + buf->size(),
static_cast<int>(len - buf->size()));
if (ret <= 0) {
ssl->s3->rwstate = SSL_READING;
@@ -163,7 +164,7 @@
return -1;
}
- if (ssl->rbio == NULL) {
+ if (ssl->rbio == nullptr) {
OPENSSL_PUT_ERROR(SSL, SSL_R_BIO_NOT_SET);
return -1;
}
@@ -240,7 +241,7 @@
SSLBuffer *buf = &ssl->s3->write_buffer;
while (!buf->empty()) {
- int ret = BIO_write(ssl->wbio, buf->data(), buf->size());
+ int ret = BIO_write(ssl->wbio.get(), buf->data(), buf->size());
if (ret <= 0) {
ssl->s3->rwstate = SSL_WRITING;
return ret;
@@ -257,7 +258,7 @@
return 1;
}
- int ret = BIO_write(ssl->wbio, buf->data(), buf->size());
+ int ret = BIO_write(ssl->wbio.get(), buf->data(), buf->size());
if (ret <= 0) {
ssl->s3->rwstate = SSL_WRITING;
// If the write failed, drop the write buffer anyway. Datagram transports
@@ -271,7 +272,7 @@
}
int ssl_write_buffer_flush(SSL *ssl) {
- if (ssl->wbio == NULL) {
+ if (ssl->wbio == nullptr) {
OPENSSL_PUT_ERROR(SSL, SSL_R_BIO_NOT_SET);
return -1;
}