[evolution-data-server] Bug #608557 - CamelOfflineJournal can call fclose with NULL



commit f1e2603da7370141d4c5a403ef1152b63dc81995
Author: Milan Crha <mcrha redhat com>
Date:   Wed Oct 13 17:21:09 2010 +0200

    Bug #608557 - CamelOfflineJournal can call fclose with NULL

 camel/camel-offline-journal.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/camel/camel-offline-journal.c b/camel/camel-offline-journal.c
index f76bc6a..09ff304 100644
--- a/camel/camel-offline-journal.c
+++ b/camel/camel-offline-journal.c
@@ -148,6 +148,9 @@ camel_offline_journal_write (CamelOfflineJournal *journal,
 	}
 
 	fp = fdopen (fd, "w");
+	if (!fp)
+		goto exception;
+
 	entry = journal->queue.head;
 	while (entry->next) {
 		if (CAMEL_OFFLINE_JOURNAL_GET_CLASS (journal)->entry_write (journal, entry, fp) == -1)
@@ -158,7 +161,8 @@ camel_offline_journal_write (CamelOfflineJournal *journal,
 	if (fsync (fd) == -1)
 		goto exception;
 
-	fclose (fp);
+	if (fp)
+		fclose (fp);
 
 	return 0;
 
@@ -171,7 +175,8 @@ camel_offline_journal_write (CamelOfflineJournal *journal,
 		camel_folder_get_full_name (journal->folder),
 		g_strerror (errno));
 
-	fclose (fp);
+	if (fp)
+		fclose (fp);
 
 	return -1;
 }



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