[gthumb/gthumb-2-10] Warn if file_data_unref called on null data - shouldn't happen



commit 32eb51252ce9f50bdb37047bb37beaf6fa29925b
Author: Michael J. Chudobiak <mjc avtechpulse com>
Date:   Fri May 1 08:43:14 2009 -0400

    Warn if file_data_unref called on null data - shouldn't happen
---
 libgthumb/file-data.c     |    3 +--
 libgthumb/file-utils.c    |    3 +++
 libgthumb/gth-file-list.c |    1 +
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/libgthumb/file-data.c b/libgthumb/file-data.c
index eeb0f95..a95414f 100644
--- a/libgthumb/file-data.c
+++ b/libgthumb/file-data.c
@@ -149,8 +149,7 @@ file_data_dup (FileData *source)
 void
 file_data_unref (FileData *fd)
 {
-	if (fd == NULL)
-		return;
+	g_return_if_fail (fd != NULL);	
 
 	fd->ref--;
 
diff --git a/libgthumb/file-utils.c b/libgthumb/file-utils.c
index bba7141..b4b2df5 100644
--- a/libgthumb/file-utils.c
+++ b/libgthumb/file-utils.c
@@ -1945,6 +1945,9 @@ resolve_symlinks (const char  *text_uri,
 
 	info = gnome_vfs_file_info_new ();
 
+	if (info == NULL)
+		return GNOME_VFS_ERROR_INVALID_URI;
+
 	resolved_uri = get_uri_host (text_uri);
 
 	tmp = build_uri (text_uri, relative_link, NULL);
diff --git a/libgthumb/gth-file-list.c b/libgthumb/gth-file-list.c
index 1e308e5..62c6513 100644
--- a/libgthumb/gth-file-list.c
+++ b/libgthumb/gth-file-list.c
@@ -1169,6 +1169,7 @@ load_new_list (GthFileList *file_list)
 			
 			file_list->priv->new_list = g_list_remove_link (file_list->priv->new_list, scan);
 			file_data_unref (scan->data);
+			g_list_free_1 (scan);
 		}
 		
 		scan = next;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]