about summary refs log tree commit diff
path: root/stdlib/canonicalize.c
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/canonicalize.c')
-rw-r--r--stdlib/canonicalize.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/stdlib/canonicalize.c b/stdlib/canonicalize.c
index 3394048fb3..5c55c5dbd1 100644
--- a/stdlib/canonicalize.c
+++ b/stdlib/canonicalize.c
@@ -73,7 +73,14 @@ __realpath (const char *name, char *resolved)
     path_max = 1024;
 #endif
 
-  rpath = resolved ? __alloca (path_max) : malloc (path_max);
+  if (resolved == NULL)
+    {
+      rpath = malloc (path_max);
+      if (rpath == NULL)
+	return NULL;
+    }
+  else
+    rpath = resolved;
   rpath_limit = rpath + path_max;
 
   if (name[0] != '/')