]> gitweb.factorcode.org Git - factor.git/blobdiff - vm/os-genunix.cpp
audio.engine.test: cleanup using
[factor.git] / vm / os-genunix.cpp
index 21b9304e40d25753a6b4cfd6c78f028a9419ea10..90a981ef31121c9692a8aa4ba6d1eb6b7a5a2845 100644 (file)
@@ -12,15 +12,15 @@ void early_init() {}
 #define SUFFIX ".image"
 #define SUFFIX_LEN 6
 
-/* You must delete[] the result yourself. */
+// You must free() the result yourself.
 const char* default_image_path() {
   const char* path = vm_executable_path();
 
   if (!path)
-    return "factor.image";
+    return strdup("factor.image");
 
-  int len = strlen(path);
-  char* new_path = new char[len + SUFFIX_LEN + 1];
+  size_t len = strlen(path);
+  char* new_path = (char *)malloc(len + SUFFIX_LEN + 1);
   memcpy(new_path, path, len);
   memcpy(new_path + len, SUFFIX, SUFFIX_LEN + 1);
   free(const_cast<char*>(path));