speex: Fix crash on Windows caused by cross-CRT issue

Use speex_header_free() to free memory which was allocated by
library. Cross-CRT issue should not happen on 1.17 Cerbero build
but might happen custom build or so.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/606>
This commit is contained in:
Seungha Yang 2020-05-29 00:45:03 +09:00
parent b94b9988fa
commit 1b8df15b78
2 changed files with 3 additions and 2 deletions

View file

@ -132,7 +132,7 @@ gst_speex_dec_reset (GstSpeexDec * dec)
dec->frame_size = 0;
dec->frame_duration = 0;
dec->mode = NULL;
free (dec->header);
speex_header_free (dec->header);
dec->header = NULL;
speex_bits_destroy (&dec->bits);
speex_bits_set_bit_buffer (&dec->bits, NULL, 0);

View file

@ -718,7 +718,8 @@ gst_speex_enc_handle_frame (GstAudioEncoder * benc, GstBuffer * buf)
/* create header buffer */
data = (guint8 *) speex_header_to_packet (&enc->header, &data_len);
buf1 = gst_buffer_new_wrapped (data, data_len);
buf1 = gst_buffer_new_wrapped_full (0,
data, data_len, 0, data_len, data, (GDestroyNotify) speex_header_free);
GST_BUFFER_OFFSET_END (buf1) = 0;
GST_BUFFER_OFFSET (buf1) = 0;