---
name: "bson_string_free"
section: "3"
platform: "linux"
package: "libbson-doc"
version: "1.30.4-1+deb13u3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/bson_string_free"
---

# bson\_string\_free(3)

**WARNING:**

Deprecated since version 1.29.0.

## SYNOPSIS

```
char *
bson_string_free (bson_string_t *string, bool free_segment);
```

## PARAMETERS

- •

  **string**: A *bson\_string\_t*.

- •

  **free\_segment**: A bool indicating whether **string-\>str** should be freed.

## DESCRIPTION

Frees the **bson\_string\_t** structure and optionally **string-\>str**.

## RETURNS

**string-\>str** if **free\_segment** is false, otherwise **NULL**.

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
