mirror of https://gitee.com/bigwinds/arangodb
fix leak in hot backup tests (#10245)
This commit is contained in:
parent
b74971c9bb
commit
5d528fffb2
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue