[tracker/tracker-0.10] libtracker-data: Small refactoring in error handling of journal writer



commit 02654e4f3f8f5508e26165792b7d40bfa84de94d
Author: Jürg Billeter <j bitron ch>
Date:   Tue May 17 14:36:26 2011 +0200

    libtracker-data: Small refactoring in error handling of journal writer

 src/libtracker-data/tracker-db-journal.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/src/libtracker-data/tracker-db-journal.c b/src/libtracker-data/tracker-db-journal.c
index d9f9bf3..ad62125 100644
--- a/src/libtracker-data/tracker-db-journal.c
+++ b/src/libtracker-data/tracker-db-journal.c
@@ -464,8 +464,6 @@ db_journal_init_file (JournalWriter  *jwriter,
 		             TRACKER_DB_JOURNAL_ERROR_COULD_NOT_WRITE,
 		             "Could not open journal for writing, %s",
 		             g_strerror (errno));
-		g_free (jwriter->journal_filename);
-		jwriter->journal_filename = NULL;
 		return FALSE;
 	}
 
@@ -485,8 +483,6 @@ db_journal_init_file (JournalWriter  *jwriter,
 			g_set_error (error, TRACKER_DB_JOURNAL_ERROR,
 			             TRACKER_DB_JOURNAL_ERROR_COULD_NOT_WRITE,
 			             "Could not write journal, not enough memory");
-			g_free (jwriter->journal_filename);
-			jwriter->journal_filename = NULL;
 			return FALSE;
 		}
 
@@ -504,8 +500,6 @@ db_journal_init_file (JournalWriter  *jwriter,
 			             TRACKER_DB_JOURNAL_ERROR_COULD_NOT_WRITE,
 			             "Could not write to journal file, %s",
 			             g_strerror (errno));
-			g_free (jwriter->journal_filename);
-			jwriter->journal_filename = NULL;
 			return FALSE;
 		}
 
@@ -551,6 +545,8 @@ db_journal_writer_init (JournalWriter  *jwriter,
 
 	if (n_error) {
 		g_propagate_error (error, n_error);
+		g_free (jwriter->journal_filename);
+		jwriter->journal_filename = NULL;
 	}
 
 	return ret;
@@ -2173,6 +2169,8 @@ tracker_db_journal_rotate (GError **error)
 
 	if (n_error) {
 		g_propagate_error (error, n_error);
+		g_free (writer.journal_filename);
+		writer.journal_filename = NULL;
 	}
 
 	return ret;



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