summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/src/os.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/src/os.c b/src/src/os.c
index 47af038f7..ca24e8dd2 100644
--- a/src/src/os.c
+++ b/src/src/os.c
@@ -879,7 +879,7 @@ char * b = (char *)buffer;
if (!size) size = PATH_MAX;
if (!b && !(b = malloc(size))) return NULL;
if (!(b = getcwd(b, size))) return NULL;
-return realloc(b, strlen(b) + 1);
+return buffer ? buffer : realloc(b, strlen(b) + 1);
}
#endif