---
name: "libressl-ERR_remove_state"
section: "3"
platform: "linux"
package: "libressl"
version: "4.4.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libressl-ERR_remove_state"
---

# libressl-ERR\_remove\_state(3)

free a thread's OpenSSL error queue

## NAME

**ERR\_remove\_thread\_state**, **ERR\_remove\_state** – free a thread's OpenSSL error queue

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

**#include \<openssl/err.h\>**

*void*\

**ERR\_remove\_thread\_state**(*const CRYPTO\_THREADID \*tid*);

Deprecated:

*void*\

**ERR\_remove\_state**(*unsigned long pid*);

## DESCRIPTION

**ERR\_remove\_thread\_state**() frees the error queue associated with thread *tid*. If *tid* is NULL, the current thread will have its error queue removed.

Since error queue data structures are allocated automatically for new threads, they must be freed when threads are terminated in order to avoid memory leaks.

**ERR\_remove\_state**() is deprecated and has been replaced by **ERR\_remove\_thread\_state**(). Since threads in OpenSSL are no longer identified by unsigned long values, any argument to this function is ignored. Calling **ERR\_remove\_state**() is equivalent to **ERR\_remove\_thread\_state**(*NULL*).

## SEE ALSO

ERR(3)

## HISTORY

**ERR\_remove\_state**() first appeared in SSLeay 0.6.1 and has been available since OpenBSD 2.4.

It was deprecated in OpenSSL 1.0.0 and OpenBSD 4.9 when **ERR\_remove\_thread\_state**() was introduced and thread IDs were introduced to identify threads instead of *unsigned* *long*.
