[easytag/easytag-2-2] Fix string leak when reading WavPack tags
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/easytag-2-2] Fix string leak when reading WavPack tags
- Date: Mon, 22 Dec 2014 09:04:57 +0000 (UTC)
commit a7250d53e8d4e782043e14de6f35cb54982326da
Author: David King <amigadave amigadave com>
Date: Sun Dec 21 22:33:25 2014 +0000
Fix string leak when reading WavPack tags
src/wavpack_tag.c | 26 ++++++++++++++++++++++----
1 files changed, 22 insertions(+), 4 deletions(-)
---
diff --git a/src/wavpack_tag.c b/src/wavpack_tag.c
index 243cce1..c78cc3b 100644
--- a/src/wavpack_tag.c
+++ b/src/wavpack_tag.c
@@ -138,11 +138,20 @@ gboolean Wavpack_Tag_Read_File_Tag (gchar *filename, File_Tag *FileTag)
if (field2 && FileTag->disc_total == NULL)
{
- FileTag->disc_total = et_disc_number_to_string (atoi (Try_To_Validate_Utf8_String (field2)));
+ gchar *tmp;
+
+ tmp = Try_To_Validate_Utf8_String (field2);
+ FileTag->disc_total = et_disc_number_to_string (atoi (tmp));
+ g_free (tmp);
}
+
if (length > 0 && FileTag->disc_number == NULL)
{
- FileTag->disc_number = et_disc_number_to_string (atoi (Try_To_Validate_Utf8_String (field)));
+ gchar *tmp;
+
+ tmp = Try_To_Validate_Utf8_String (field);
+ FileTag->disc_number = et_disc_number_to_string (atoi (tmp));
+ g_free (tmp);
}
memset (field, '\0', MAXLEN);
@@ -172,11 +181,20 @@ gboolean Wavpack_Tag_Read_File_Tag (gchar *filename, File_Tag *FileTag)
if (field2 && FileTag->track_total == NULL)
{
- FileTag->track_total = et_track_number_to_string (atoi (Try_To_Validate_Utf8_String (field2)));
+ gchar *tmp;
+
+ tmp = Try_To_Validate_Utf8_String (field2);
+ FileTag->track_total = et_track_number_to_string (atoi (tmp));
+ g_free (tmp);
}
+
if (length > 0 && FileTag->track == NULL)
{
- FileTag->track = et_track_number_to_string (atoi (Try_To_Validate_Utf8_String (field)));
+ gchar *tmp;
+
+ tmp = Try_To_Validate_Utf8_String (field);
+ FileTag->track = et_track_number_to_string (atoi (tmp));
+ g_free (tmp);
}
memset (field, '\0', MAXLEN);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]