[tracker] only load the keyfile if it exists



commit 18b10a365e0fa736590dca83fccf4895ae7c8af5
Author: Saleem Abdulrasool <compnerd compnerd org>
Date:   Thu Mar 25 16:08:29 2010 -0700

    only load the keyfile if it exists
    
    bonus: fix minor memory leak

 .../tracker-password-provider-keyfile.c            |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-password-provider-keyfile.c b/src/libtracker-miner/tracker-password-provider-keyfile.c
index 300070c..9867f56 100644
--- a/src/libtracker-miner/tracker-password-provider-keyfile.c
+++ b/src/libtracker-miner/tracker-password-provider-keyfile.c
@@ -22,6 +22,7 @@
 #include <sys/mman.h>
 
 #include <glib-object.h>
+#include <gio/gio.h>
 
 #include "tracker-password-provider.h"
 
@@ -361,10 +362,14 @@ load_password_file (TrackerPasswordProviderKeyfile  *kf,
 
 	priv = TRACKER_PASSWORD_PROVIDER_KEYFILE_GET_PRIVATE (kf);
 
-	g_key_file_load_from_file (priv->password_file,
-	                           filename,
-	                           G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS,
-	                           error);
+	if (g_file_test (filename, G_FILE_TEST_EXISTS)) {
+		g_key_file_load_from_file (priv->password_file,
+		                           filename,
+		                           G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS,
+		                           error);
+	}
+
+	g_free (filename);
 }
 
 static gboolean



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