[easytag] Fix memory leak when loading a Speex file
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag] Fix memory leak when loading a Speex file
- Date: Sun, 14 Dec 2014 16:27:59 +0000 (UTC)
commit 699747408eeb2407ba9d5ed7babe472a500af25e
Author: David King <amigadave amigadave com>
Date: Sun Dec 14 13:54:44 2014 +0000
Fix memory leak when loading a Speex file
src/tags/vcedit.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/src/tags/vcedit.c b/src/tags/vcedit.c
index 28c086a..b390fdb 100644
--- a/src/tags/vcedit.c
+++ b/src/tags/vcedit.c
@@ -74,6 +74,12 @@ static void vcedit_clear_internals(vcedit_state *state)
vorbis_info_clear(state->vi);
free(state->vi);
}
+#ifdef ENABLE_SPEEX
+ if (state->si)
+ {
+ speex_header_free (state->si);
+ }
+#endif
#ifdef ENABLE_OPUS
if (state->oi)
{
@@ -379,11 +385,13 @@ vcedit_open(vcedit_state *state, GFile *file, GError **error)
else
{
#ifdef ENABLE_SPEEX
- // Done after "Ogg test" to avoid to display an error message in function
- // speex_packet_to_header when the file is not Speex.
- state->si = malloc(sizeof(SpeexHeader));
- if((state->si = speex_packet_to_header((char*)(&header_main)->packet,(&header_main)->bytes)))
+ /* Done after "Ogg test" to avoid to display an error message in
+ * function speex_packet_to_header() when the file is not Speex. */
+ if((state->si = speex_packet_to_header ((char*)(&header_main)->packet,
+ (&header_main)->bytes)))
+ {
state->oggtype = VCEDIT_IS_SPEEX;
+ }
#endif
#ifdef ENABLE_OPUS
if (state->oggtype == VCEDIT_IS_UNKNOWN)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]