diff options
Diffstat (limited to 'src/crypto/pool/pool.c')
-rw-r--r-- | src/crypto/pool/pool.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/crypto/pool/pool.c b/src/crypto/pool/pool.c index 44d10af6..9cfbf1ee 100644 --- a/src/crypto/pool/pool.c +++ b/src/crypto/pool/pool.c @@ -125,8 +125,8 @@ CRYPTO_BUFFER *CRYPTO_BUFFER_new(const uint8_t *data, size_t len, CRYPTO_MUTEX_unlock_write(&pool->lock); if (!inserted) { - /* We raced to insert |buf| into the pool and lost, or else there was an - * error inserting. */ + // We raced to insert |buf| into the pool and lost, or else there was an + // error inserting. OPENSSL_free(buf->data); OPENSSL_free(buf); return duplicate; @@ -147,9 +147,9 @@ void CRYPTO_BUFFER_free(CRYPTO_BUFFER *buf) { CRYPTO_BUFFER_POOL *const pool = buf->pool; if (pool == NULL) { if (CRYPTO_refcount_dec_and_test_zero(&buf->references)) { - /* If a reference count of zero is observed, there cannot be a reference - * from any pool to this buffer and thus we are able to free this - * buffer. */ + // If a reference count of zero is observed, there cannot be a reference + // from any pool to this buffer and thus we are able to free this + // buffer. OPENSSL_free(buf->data); OPENSSL_free(buf); } @@ -163,10 +163,10 @@ void CRYPTO_BUFFER_free(CRYPTO_BUFFER *buf) { return; } - /* We have an exclusive lock on the pool, therefore no concurrent lookups can - * find this buffer and increment the reference count. Thus, if the count is - * zero there are and can never be any more references and thus we can free - * this buffer. */ + // We have an exclusive lock on the pool, therefore no concurrent lookups can + // find this buffer and increment the reference count. Thus, if the count is + // zero there are and can never be any more references and thus we can free + // this buffer. void *found = lh_CRYPTO_BUFFER_delete(pool->bufs, buf); assert(found != NULL); assert(found == buf); @@ -177,12 +177,12 @@ void CRYPTO_BUFFER_free(CRYPTO_BUFFER *buf) { } int CRYPTO_BUFFER_up_ref(CRYPTO_BUFFER *buf) { - /* This is safe in the case that |buf->pool| is NULL because it's just - * standard reference counting in that case. - * - * This is also safe if |buf->pool| is non-NULL because, if it were racing - * with |CRYPTO_BUFFER_free| then the two callers must have independent - * references already and so the reference count will never hit zero. */ + // This is safe in the case that |buf->pool| is NULL because it's just + // standard reference counting in that case. + // + // This is also safe if |buf->pool| is non-NULL because, if it were racing + // with |CRYPTO_BUFFER_free| then the two callers must have independent + // references already and so the reference count will never hit zero. CRYPTO_refcount_inc(&buf->references); return 1; } |