Revert "Fix memory leak in uv_exepath() on OSX."

This reverts commit f6c8e78db9.

realpath() on OS X 10.5 crashes if resolved_path == NULL.
This commit is contained in:
Ben Noordhuis 2012-04-06 00:55:04 +02:00
parent f6df47b474
commit 637d976c19

View File

@ -73,6 +73,7 @@ uint64_t uv_hrtime() {
int uv_exepath(char* buffer, size_t* size) {
uint32_t usize;
int result;
char* path;
char* fullpath;
if (!buffer || !size) {
@ -83,9 +84,11 @@ int uv_exepath(char* buffer, size_t* size) {
result = _NSGetExecutablePath(buffer, &usize);
if (result) return result;
fullpath = realpath(buffer, NULL);
path = (char*)malloc(2 * PATH_MAX);
fullpath = realpath(buffer, path);
if (fullpath == NULL) {
free(path);
return -1;
}