diff options
author | Seungha Yang <seungha@centricular.com> | 2020-05-29 00:45:03 +0900 |
---|---|---|
committer | GStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org> | 2020-09-25 08:49:28 +0000 |
commit | 275bbc64f81ebc7036a0e89d1a3f3c6687c2d821 (patch) | |
tree | 000c7d736d40b36010c70d6474e19b6d6fc954cb | |
parent | 68dd1ee9065b120852ed609517b180cfee0cf442 (diff) |
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/745>
-rw-r--r-- | ext/speex/gstspeexdec.c | 2 | ||||
-rw-r--r-- | ext/speex/gstspeexenc.c | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/ext/speex/gstspeexdec.c b/ext/speex/gstspeexdec.c index cc123ce06..f880f818b 100644 --- a/ext/speex/gstspeexdec.c +++ b/ext/speex/gstspeexdec.c @@ -133,7 +133,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); diff --git a/ext/speex/gstspeexenc.c b/ext/speex/gstspeexenc.c index 4266af63b..496a3a652 100644 --- a/ext/speex/gstspeexenc.c +++ b/ext/speex/gstspeexenc.c @@ -719,7 +719,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; |