macos: fix leak in proc_self_dirname()

This commit is contained in:
Zachary Snow
2021-06-14 12:33:26 -04:00
committed by Zachary Snow
parent 081111714e
commit b516c681fe
+3 -1
View File
@@ -797,7 +797,9 @@ std::string proc_self_dirname()
path = (char *) realloc((void *) path, buflen);
while (buflen > 0 && path[buflen-1] != '/')
buflen--;
return std::string(path, buflen);
std::string str(path, buflen);
free(path);
return str;
}
#elif defined(_WIN32)
std::string proc_self_dirname()