### Function

# GLib ByteArray free

#### Declaration

    guint8*
    g_byte_array_free (
      GByteArray* array,
      gboolean free_segment
    )

#### Description

Frees the memory allocated by the `GByteArray`. If `free_segment` is `TRUE` it frees the actual byte data. If the reference count of `array` is greater than one, the `GByteArray` wrapper is preserved but the size of `array` will be set to zero.

#### Parameters

`array`

  Type: An array of `guint8`

  A `GByteArray`.

  The data is owned by the caller of the function.

`free_segment`

  Type: `gboolean`

  If `TRUE` the actual byte data is freed as well.

#### Return value

Type: `guint8*`

The element data if `free_segment` is `FALSE`, otherwise `NULL`. The element data should be freed using g_free().

The data is owned by the called function.