Hi!

Electron reported a regression due to my patch fixing resource leak in
fimonitor.cc this patch fix the regression
From 7c8c7a4e58df8bd1b791911e83674741bd7de96a Mon Sep 17 00:00:00 2001
From: Gioacchino Mazzurco <g...@eigenlab.org>
Date: Sat, 10 Jan 2015 20:05:17 +0100
Subject: [PATCH] fimonitor: close file before renaming thanks electron

---
 libretroshare/src/dbase/fimonitor.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libretroshare/src/dbase/fimonitor.cc b/libretroshare/src/dbase/fimonitor.cc
index 787a210..5ad2aba 100644
--- a/libretroshare/src/dbase/fimonitor.cc
+++ b/libretroshare/src/dbase/fimonitor.cc
@@ -266,9 +266,11 @@ void HashCache::save()
 	if(fwrite(encryptedData,1,encDataLen,F) != encDataLen)
 	{
 		std::cerr << "Could not write entire encrypted hash cache file. Out of disc space??" << std::endl;
-		goto save_close;
+		fclose(F);
+		goto save_free;
 	}

+	fclose(F);
 	RsDirUtil::renameFile(_path+".bin.tmp",_path+".bin") ;
 #ifdef FIM_DEBUG
 	std::cerr << "done." << std::endl ;
@@ -276,8 +278,6 @@ void HashCache::save()

 	_changed = false;

-save_close:
-	fclose(F);
 save_free:
 	free(encryptedData);
 }
--
2.0.5

Attachment: signature.asc
Description: This is a digitally signed message part.

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
Retroshare-devel mailing list
Retroshare-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/retroshare-devel

Reply via email to