---
name: "SSL_alloc_buffers"
section: "3ssl"
platform: "linux"
package: "openssl"
version: "3.6.5-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/SSL_alloc_buffers"
---

# SSL\_alloc\_buffers(3ssl)

manage SSL structure buffers

## NAME

SSL\_free\_buffers, SSL\_alloc\_buffers - manage SSL structure buffers

## SYNOPSIS

```
 #include <openssl/ssl.h>
 int SSL_free_buffers(SSL *ssl);
 int SSL_alloc_buffers(SSL *ssl);
```

## DESCRIPTION

**SSL\_free\_buffers()** frees the read and write buffers of the given **ssl**. **SSL\_alloc\_buffers()** allocates the read and write buffers of the given **ssl**.

The **SSL\_MODE\_RELEASE\_BUFFERS** mode releases read or write buffers whenever the buffers have been drained. These functions allow applications to manually control when buffers are freed and allocated.

After freeing the buffers, the buffers are automatically reallocated upon a new read or write. The **SSL\_alloc\_buffers()** does not need to be called, but can be used to make sure the buffers are preallocated. This can be used to avoid allocation during data processing or with **CRYPTO\_set\_mem\_functions()** to control where and how buffers are allocated.

These functions are no-ops when used with QUIC SSL objects. For QUIC, **SSL\_free\_buffers()** always fails, and **SSL\_alloc\_buffers()** always succeeds.

## RETURN VALUES

The following return values can occur:

- 0 (Failure)

  The **SSL\_free\_buffers()** function returns 0 when there is pending data to be read or written. The **SSL\_alloc\_buffers()** function returns 0 when there is an allocation failure.

- 1 (Success)

  The **SSL\_free\_buffers()** function returns 1 if the buffers have been freed. This value is also returned if the buffers had been freed before calling **SSL\_free\_buffers()**. The **SSL\_alloc\_buffers()** function returns 1 if the buffers have been allocated. This value is also returned if the buffers had been allocated before calling **SSL\_alloc\_buffers()**.

## SEE ALSO

[**ssl**(7)](/ssl/7.md), **SSL\_free**(3), **SSL\_clear**(3), **SSL\_new**(3), **SSL\_CTX\_set\_mode**(3), **CRYPTO\_set\_mem\_functions**(3)

## COPYRIGHT

Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the "License").  You may not use this file except in compliance with the License.  You can obtain a copy in the file LICENSE in the source distribution or at \<https://www.openssl.org/source/license.html\>.
