Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
Revert "Fix memory leak in uv_exepath() on OSX."
Browse files Browse the repository at this point in the history
This reverts commit f6c8e78.

realpath() on OS X 10.5 crashes if resolved_path == NULL.
  • Loading branch information
bnoordhuis committed Apr 5, 2012
1 parent f6df47b commit 637d976
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/unix/darwin.c
Expand Up @@ -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) {
Expand All @@ -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;
}

Expand Down

0 comments on commit 637d976

Please sign in to comment.