1
0
Fork 0

fix leak in hot backup tests (#10245)

This commit is contained in:
Jan 2019-10-14 15:28:25 +02:00 committed by KVS85
parent b74971c9bb
commit 5d528fffb2
1 changed files with 16 additions and 22 deletions

View File

@ -69,46 +69,40 @@ struct CFilesSetup {
TRI_RemoveDirectory(_directory.c_str());
}
StringBuffer* writeFile (const char* blob) {
StringBuffer* filename = new StringBuffer(true);
filename->appendText(_directory);
filename->appendChar(TRI_DIR_SEPARATOR_CHAR);
filename->appendText("tmp-");
filename->appendInteger(++counter);
filename->appendInteger(arangodb::RandomGenerator::interval(UINT32_MAX));
void writeFile(char const* blob) {
StringBuffer filename(true);
filename.appendText(_directory);
filename.appendChar(TRI_DIR_SEPARATOR_CHAR);
filename.appendText("tmp-");
filename.appendInteger(++counter);
filename.appendInteger(arangodb::RandomGenerator::interval(UINT32_MAX));
FILE* fd = fopen(filename->c_str(), "wb");
FILE* fd = fopen(filename.c_str(), "wb");
if (fd) {
size_t numWritten = fwrite(blob, strlen(blob), 1, fd);
(void) numWritten;
fclose(fd);
}
else {
} else {
EXPECT_TRUE(false);
}
return filename;
}
StringBuffer * writeFile (const char * name, const char * blob) {
StringBuffer* filename = new StringBuffer(true);
filename->appendText(_directory);
filename->appendChar(TRI_DIR_SEPARATOR_CHAR);
filename->appendText(name);
void writeFile(char const* name, char const* blob) {
StringBuffer filename(true);
filename.appendText(_directory);
filename.appendChar(TRI_DIR_SEPARATOR_CHAR);
filename.appendText(name);
FILE* fd = fopen(filename->c_str(), "wb");
FILE* fd = fopen(filename.c_str(), "wb");
if (fd) {
size_t numWritten = fwrite(blob, strlen(blob), 1, fd);
(void) numWritten;
fclose(fd);
}
else {
} else {
EXPECT_TRUE(false);
}
return filename;
}
StringBuffer _directory;