Fix various memleaks in the tests

This commit is contained in:
Uwe L. Korn
2014-09-14 18:03:27 +01:00
parent 4b67beffc8
commit 205569c8d2
7 changed files with 16 additions and 1 deletions

View File

@ -11,6 +11,7 @@
#include <sys/stat.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <fstream>
@ -26,7 +27,9 @@ inline string testFilePath(const string &filename)
inline string copyFile(const string &filename, const string &ext)
{
string newname = string(tempnam(NULL, NULL)) + ext;
char *newname_c = tempnam(NULL, NULL);
string newname = string(newname_c) + ext;
free(newname_c);
string oldname = testFilePath(filename) + ext;
#ifdef _WIN32
CopyFileA(oldname.c_str(), newname.c_str(), FALSE);