[Box Backup-commit] COMMIT r1302 - box/chris/general/test/backupstore

boxbackup-dev@fluffy.co.uk boxbackup-dev@fluffy.co.uk
Sun, 25 Feb 2007 15:33:18 +0000


Author: chris
Date: 2007-02-25 15:33:17 +0000 (Sun, 25 Feb 2007)
New Revision: 1302

Modified:
   box/chris/general/test/backupstore/testbackupstore.cpp
Log:
Fix memory leaks and false alarms detected by new memory leak code


Modified: box/chris/general/test/backupstore/testbackupstore.cpp
===================================================================
--- box/chris/general/test/backupstore/testbackupstore.cpp	2007-02-25 15:12:30 UTC (rev 1301)
+++ box/chris/general/test/backupstore/testbackupstore.cpp	2007-02-25 15:33:17 UTC (rev 1302)
@@ -1949,6 +1949,7 @@
 
 	CloseHandle(h2);
 	CloseHandle(h1);
+	delete [] wfile;
 
 	h1 = openfile("foo", O_CREAT | O_RDWR, 0);
 	TEST_THAT(h1 != INVALID_HANDLE_VALUE);
@@ -1980,15 +1981,20 @@
 	BackupClientCryptoKeys_Setup("testfiles/bbackupd.keys");	
 #endif
 	
-	// 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