[Box Backup-commit] COMMIT r1160 - in box/chris/merge/test: backupstore backupstorefix

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Mon Nov 13 16:10:00 GMT 2006


Author: chris
Date: 2006-11-13 16:10:00 +0000 (Mon, 13 Nov 2006)
New Revision: 1160

Modified:
   box/chris/merge/test/backupstore/testbackupstore.cpp
   box/chris/merge/test/backupstorefix/testbackupstorefix.cpp
Log:
Fix memory leak false alarms caused by modifying static objects (refs #3)


Modified: box/chris/merge/test/backupstore/testbackupstore.cpp
===================================================================
--- box/chris/merge/test/backupstore/testbackupstore.cpp	2006-11-13 16:07:36 UTC (rev 1159)
+++ box/chris/merge/test/backupstore/testbackupstore.cpp	2006-11-13 16:10:00 UTC (rev 1160)
@@ -1926,15 +1926,20 @@
 	// for seeing what's going on.
 	BackupClientCryptoKeys_Setup("testfiles/bbackupd.keys");	
 	
-	// encode in some filenames -- can't do static initialisation because the key won't be set up when these are initialised
-	for(unsigned int l = 0; l < sizeof(ens_filenames) / sizeof(ens_filenames[0]); ++l)
+	// encode in some filenames -- can't do static initialisation 
+	// because the key won't be set up when these are initialised
 	{
-		ens[l].fn = BackupStoreFilenameClear(ens_filenames[l]);
+		MEMLEAKFINDER_NO_LEAKS
+
+		for(unsigned int l = 0; l < sizeof(ens_filenames) / sizeof(ens_filenames[0]); ++l)
+		{
+			ens[l].fn = BackupStoreFilenameClear(ens_filenames[l]);
+		}
+		for(unsigned int l = 0; l < sizeof(uploads_filenames) / sizeof(uploads_filenames[0]); ++l)
+		{
+			uploads[l].name = BackupStoreFilenameClear(uploads_filenames[l]);
+		}
 	}
-	for(unsigned int l = 0; l < sizeof(uploads_filenames) / sizeof(uploads_filenames[0]); ++l)
-	{
-		uploads[l].name = BackupStoreFilenameClear(uploads_filenames[l]);
-	}
 	
 	// Trace errors out
 	SET_DEBUG_SSLLIB_TRACE_ERRORS

Modified: box/chris/merge/test/backupstorefix/testbackupstorefix.cpp
===================================================================
--- box/chris/merge/test/backupstorefix/testbackupstorefix.cpp	2006-11-13 16:07:36 UTC (rev 1159)
+++ box/chris/merge/test/backupstorefix/testbackupstorefix.cpp	2006-11-13 16:10:00 UTC (rev 1160)
@@ -202,9 +202,12 @@
 
 void test_dir_fixing()
 {
-	fnames[0].SetAsClearFilename("x1");
-	fnames[1].SetAsClearFilename("x2");
-	fnames[2].SetAsClearFilename("x3");
+	{
+		MEMLEAKFINDER_NO_LEAKS;
+		fnames[0].SetAsClearFilename("x1");
+		fnames[1].SetAsClearFilename("x2");
+		fnames[2].SetAsClearFilename("x3");
+	}
 
 	{
 		BackupStoreDirectory dir;
@@ -344,6 +347,7 @@
 				TEST_THAT(::sscanf(line, "%x %s %s", &id, flags, name) == 3);
 				bool isDir = (::strcmp(flags, "-d---") == 0);
 				//TRACE3("%x,%d,%s\n", id, isDir, name);
+				MEMLEAKFINDER_NO_LEAKS;
 				nameToID[std::string(name)] = id;
 				objectIsDir[id] = isDir;
 			}




More information about the Boxbackup-commit mailing list