[easytag] Fix leaks of track number strings in CDDB dialog
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag] Fix leaks of track number strings in CDDB dialog
- Date: Mon, 3 Nov 2014 22:41:13 +0000 (UTC)
commit 6cfe0b7cb430c849ef2c303d8df5e1b7b51b8bb7
Author: David King <amigadave amigadave com>
Date: Mon Nov 3 22:15:56 2014 +0000
Fix leaks of track number strings in CDDB dialog
src/cddb_dialog.c | 30 ++++++++++++++++++++----------
1 files changed, 20 insertions(+), 10 deletions(-)
---
diff --git a/src/cddb_dialog.c b/src/cddb_dialog.c
index 06fa163..163bbae 100644
--- a/src/cddb_dialog.c
+++ b/src/cddb_dialog.c
@@ -2479,18 +2479,25 @@ Cddb_Set_Track_Infos_To_File_List (EtCDDBDialog *self)
if (set_fields & ET_CDDB_SET_FIELD_TRACK)
{
- snprintf (buffer, sizeof (buffer), "%s",
- et_track_number_to_string (cddbtrackalbum->track_number));
+ gchar *track_number;
- ET_Set_Field_File_Tag_Item (&FileTag->track, buffer);
+ track_number = et_track_number_to_string (cddbtrackalbum->track_number);
+
+ ET_Set_Field_File_Tag_Item (&FileTag->track, track_number);
+
+ g_free (track_number);
}
if (set_fields & ET_CDDB_SET_FIELD_TRACK_TOTAL)
{
- snprintf (buffer, sizeof (buffer), "%s",
- et_track_number_to_string (list_length));
+ gchar *track_total;
- ET_Set_Field_File_Tag_Item (&FileTag->track_total, buffer);
+ track_total = et_track_number_to_string (list_length);
+
+ ET_Set_Field_File_Tag_Item (&FileTag->track_total,
+ track_total);
+
+ g_free (track_total);
}
if ((set_fields & ET_CDDB_SET_FIELD_GENRE)
@@ -2516,22 +2523,25 @@ Cddb_Set_Track_Infos_To_File_List (EtCDDBDialog *self)
*/
if (set_fields & ET_CDDB_SET_FIELD_FILENAME)
{
+ gchar *track_number;
gchar *filename_generated_utf8;
gchar *filename_new_utf8;
// Allocation of a new FileName
FileName = ET_File_Name_Item_New();
- // Build the filename with the path
- snprintf (buffer, sizeof (buffer), "%s",
- et_track_number_to_string (cddbtrackalbum->track_number));
+ /* Build the filename with the path. */
+ track_number = et_track_number_to_string (cddbtrackalbum->track_number);
- filename_generated_utf8 = g_strconcat(buffer," - ",cddbtrackalbum->track_name,NULL);
+ filename_generated_utf8 = g_strconcat (track_number, " - ",
+ cddbtrackalbum->track_name,
+ NULL);
ET_File_Name_Convert_Character(filename_generated_utf8); // Replace invalid characters
filename_new_utf8 = ET_File_Name_Generate(etfile,filename_generated_utf8);
ET_Set_Filename_File_Name_Item(FileName,filename_new_utf8,NULL);
+ g_free (track_number);
g_free(filename_generated_utf8);
g_free(filename_new_utf8);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]