mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-09-08 13:18:52 +00:00
speexenc: ensure to free allocated padded data
This commit is contained in:
parent
c0d86fd26f
commit
7df8122322
1 changed files with 3 additions and 2 deletions
|
@ -547,7 +547,7 @@ gst_speex_enc_encode (GstSpeexEnc * enc, GstBuffer * buf)
|
||||||
gint frame_size = enc->frame_size;
|
gint frame_size = enc->frame_size;
|
||||||
gint bytes = frame_size * 2 * enc->channels, samples, size;
|
gint bytes = frame_size * 2 * enc->channels, samples, size;
|
||||||
gint outsize, written, dtx_ret = 0;
|
gint outsize, written, dtx_ret = 0;
|
||||||
guint8 *data;
|
guint8 *data, *data0 = NULL;
|
||||||
GstBuffer *outbuf;
|
GstBuffer *outbuf;
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
|
|
||||||
|
@ -558,7 +558,7 @@ gst_speex_enc_encode (GstSpeexEnc * enc, GstBuffer * buf)
|
||||||
if (G_UNLIKELY (size % bytes)) {
|
if (G_UNLIKELY (size % bytes)) {
|
||||||
GST_DEBUG_OBJECT (enc, "draining; adding silence samples");
|
GST_DEBUG_OBJECT (enc, "draining; adding silence samples");
|
||||||
size = ((size / bytes) + 1) * bytes;
|
size = ((size / bytes) + 1) * bytes;
|
||||||
data = g_malloc0 (size);
|
data0 = data = g_malloc0 (size);
|
||||||
memcpy (data, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
|
memcpy (data, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -610,6 +610,7 @@ gst_speex_enc_encode (GstSpeexEnc * enc, GstBuffer * buf)
|
||||||
outbuf, samples);
|
outbuf, samples);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
g_free (data0);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue