changeset 1244:1a93e6f2c98d trunk

[svn] - fix some possible segmentation violations
author nenolod
date Wed, 14 Jun 2006 23:58:18 -0700
parents 7c765d74d643
children 665c2e91f158
files ChangeLog Plugins/Input/flac/tag.c
diffstat 2 files changed, 15 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Jun 14 23:24:23 2006 -0700
+++ b/ChangeLog	Wed Jun 14 23:58:18 2006 -0700
@@ -1,3 +1,12 @@
+2006-06-15 06:24:23 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [1400]
+  - fill in the length part of the tuple (oops)
+  
+
+  Changes:        Modified:
+  +5 -0           trunk/Plugins/Input/console/Audacious_Driver.cpp  
+
+
 2006-06-15 06:19:56 +0000  William Pitcock <nenolod@nenolod.net>
   revision [1398]
   - get_song_tuple() implementation (scrobblerific!)
--- a/Plugins/Input/flac/tag.c	Wed Jun 14 23:24:23 2006 -0700
+++ b/Plugins/Input/flac/tag.c	Wed Jun 14 23:58:18 2006 -0700
@@ -52,7 +52,7 @@
 static char *local__getstr(char* str)
 {
 	if (str && strlen(str) > 0)
-		return str;
+		return g_strdup(str);
 	return NULL;
 }
 
@@ -90,8 +90,9 @@
 	TitleInput *input = NULL;
 	FLAC__StreamMetadata *tags;
 	char *title, *artist, *performer, *album, *date, *tracknumber, *genre, *description;
+	gchar *filename_proxy = g_strdup(filename);
 
-	FLAC_plugin__tags_get(filename, &tags);
+	FLAC_plugin__tags_get(filename_proxy, &tags);
 
 	title       = local__getfield(tags, "TITLE");
 	artist      = local__getfield(tags, "ARTIST");
@@ -114,9 +115,9 @@
 	input->genre = local__getstr(genre);
 	input->comment = local__getstr(description);
 
-	input->file_name = g_path_get_basename(filename);
-	input->file_path = filename;
-	input->file_ext = local__extname(filename);
+	input->file_name = g_path_get_basename(filename_proxy);
+	input->file_path = filename_proxy;
+	input->file_ext = local__extname(filename_proxy);
 
 	return input;
 }