diff --git a/gst-libs/gst/audio/gstaudioencoder.c b/gst-libs/gst/audio/gstaudioencoder.c index 1780de43ec..add902e9f2 100644 --- a/gst-libs/gst/audio/gstaudioencoder.c +++ b/gst-libs/gst/audio/gstaudioencoder.c @@ -439,14 +439,15 @@ gst_audio_encoder_reset (GstAudioEncoder * enc, gboolean full) enc->priv->active = FALSE; enc->priv->samples_in = 0; enc->priv->bytes_out = 0; - gst_audio_info_init (&enc->priv->ctx.info); - memset (&enc->priv->ctx, 0, sizeof (enc->priv->ctx)); g_list_foreach (enc->priv->ctx.headers, (GFunc) gst_buffer_unref, NULL); g_list_free (enc->priv->ctx.headers); enc->priv->ctx.headers = NULL; enc->priv->ctx.new_headers = FALSE; + memset (&enc->priv->ctx, 0, sizeof (enc->priv->ctx)); + gst_audio_info_init (&enc->priv->ctx.info); + if (enc->priv->tags) gst_tag_list_free (enc->priv->tags); enc->priv->tags = NULL; @@ -828,6 +829,8 @@ exit: no_caps: { GST_ELEMENT_ERROR (enc, STREAM, ENCODE, ("no caps set"), (NULL)); + if (buf) + gst_buffer_unref (buf); return GST_FLOW_ERROR; } overflow: