patacongo commented on a change in pull request #2904:
URL: https://github.com/apache/incubator-nuttx/pull/2904#discussion_r583075013



##########
File path: libs/libc/unistd/lib_getcwd.c
##########
@@ -115,6 +124,16 @@ FAR char *getcwd(FAR char *buf, size_t size)
       return NULL;
     }
 
+  if (buf == NULL)
+    {
+      buf = malloc(size);

Review comment:
       malloc() should not be used.  Use lib_malloc() instead.  That eliminates 
the problem case where this function is called from within the OS in certain 
build modes and malloc does not do what you would want it do do.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to