---
name: "krb5_free_error"
section: "3"
platform: "linux"
package: "heimdal-dev"
version: "7.8.git20221117.28daf24+dfsg-9+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/krb5_free_error"
---

# krb5\_free\_error(3)

parse, free and read error from KRB-ERROR message

## NAME

**krb5\_rd\_error**, **krb5\_free\_error**, **krb5\_free\_error\_contents**, **krb5\_error\_from\_rd\_error** – parse, free and read error from KRB-ERROR message

## LIBRARY

Kerberos 5 Library (libkrb5, -lkrb5)

## SYNOPSIS

**#include \<krb5.h\>**

*krb5\_error\_code*\

**krb5\_rd\_error**(*krb5\_context context*, *const krb5\_data \*msg*, *KRB\_ERROR \*result*);

*void*\

**krb5\_free\_error**(*krb5\_context context*, *krb5\_error \*error*);

*void*\

**krb5\_free\_error\_contents**(*krb5\_context context*, *krb5\_error \*error*);

*krb5\_error\_code*\

**krb5\_error\_from\_rd\_error**(*krb5\_context context*, *const krb5\_error \*error*, *const krb5\_creds \*creds*);

## DESCRIPTION

Usually applications never needs to parse and understand Kerberos error messages since higher level functions will parse and push up the error in the krb5\_context. These functions are described for completeness.

**krb5\_rd\_error**() parses and returns the kerboeros error message, the structure should be freed with **krb5\_free\_error\_contents**() when the caller is done with the structure.

**krb5\_free\_error**() frees the content and the memory region holding the structure iself.

**krb5\_free\_error\_contents**() free the content of the KRB-ERROR message.

**krb5\_error\_from\_rd\_error**() will parse the error message and set the error buffer in krb5\_context to the error string passed back or the matching error code in the KRB-ERROR message. Caller should pick up the message with **krb5\_get\_error\_string**(*3*) (don't forget to free the returned string with **krb5\_free\_error\_string**()).

## SEE ALSO

[krb5(3)](/krb5/3.md), [krb5\_set\_error\_string(3)](/krb5_set_error_string/3.md), [krb5\_get\_error\_string(3)](/krb5_get_error_string/3.md), [krb5.conf(5)](/krb5.conf/5.md)
