changeset 1264:5fe8289b9aed

a bunch of paranoid checks for the return value of g_filename_from_uri
author Giacomo Lozito <james@develia.org>
date Fri, 13 Jul 2007 21:31:17 +0200
parents 458d46e65a86
children 7c6a443ac48b 47559538ce3d
files src/madplug/fileinfo.c src/wav/wav-sndfile.c
diffstat 2 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/madplug/fileinfo.c	Fri Jul 13 20:55:42 2007 +0200
+++ b/src/madplug/fileinfo.c	Fri Jul 13 21:31:17 2007 +0200
@@ -590,6 +590,16 @@
     }
 
     tmp = g_filename_from_uri(fileurl, NULL, NULL);
+    if (tmp == NULL)
+    {
+#ifdef DEBUG
+        tmp = str_to_utf8(fileurl);
+        g_message("f: audmad_get_file_info: %s , g_filename_from_uri failed", tmp);
+        g_free(tmp);
+        tmp = NULL;
+#endif
+        return;
+    }
     utf_filename = str_to_utf8(tmp);
     g_free(tmp);
     tmp = NULL;
--- a/src/wav/wav-sndfile.c	Fri Jul 13 20:55:42 2007 +0200
+++ b/src/wav/wav-sndfile.c	Fri Jul 13 21:31:17 2007 +0200
@@ -233,6 +233,9 @@
 	int pcmbitwidth;
 	gchar *song_title;
 
+	if (filename == NULL)
+		return;
+
 	if (sndfile)
 		return;
 
@@ -313,6 +316,8 @@
 get_song_info (char *fileuri, char **title, int *length)
 {
 	gchar *filename = g_filename_from_uri(fileuri, NULL, NULL);
+	if (filename == NULL)
+		return;
 	(*length) = get_song_length(filename);
 	(*title) = get_title(filename);
 	g_free(filename);