Remove two small memory leaks on Linux

db4
Samuel Tardieu 2009-10-03 18:17:55 +02:00
parent 8a7e9740c9
commit 2bbad8d837
2 changed files with 6 additions and 2 deletions

View File

@ -30,6 +30,7 @@ const char *default_image_path()
char *new_path = new char[PATH_MAX + SUFFIX_LEN + 1];
memcpy(new_path,path,len + 1);
memcpy(new_path + len,SUFFIX,SUFFIX_LEN + 1);
free(const_cast<char *>(path));
return new_path;
}

View File

@ -3,7 +3,7 @@
namespace factor
{
/* Snarfed from SBCL linux-so.c. You must delete[] the result yourself. */
/* Snarfed from SBCL linux-so.c. You must free() the result yourself. */
const char *vm_executable_path()
{
char *path = new char[PATH_MAX + 1];
@ -17,7 +17,10 @@ const char *vm_executable_path()
else
{
path[size] = '\0';
return safe_strdup(path);
const char *ret = safe_strdup(path);
delete[] path;
return ret;
}
}