### Method

# GLib String free

#### Declaration [src]

    gchar*
    g_string_free (
      GString* string,
      gboolean free_segment
    )

#### Description [src]

Frees the memory allocated for the `GString`. If `free_segment` is `TRUE` it also frees the character data. If it’s `FALSE`, the caller gains ownership of the buffer and must free it after use with g_free().

Instead of passing `FALSE` to this function, consider using g_string_free_and_steal().

#### Parameters

`string`

  Type: `GString`

  A `GString`.

  The instance takes ownership of the data, and is responsible for freeing it.

`free_segment`

  Type: `gboolean`

  If `TRUE`, the actual character data is freed as well.

#### Return value

Type: `gchar*`

The character data of `string` (i.e. `NULL` if `free_segment` is `TRUE`).

The caller of the method takes ownership of the returned data, and is responsible for freeing it.
The return value can be `NULL`.
The value is a NUL terminated UTF-8 string.