This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit c6c1ec81e0277fded6c6a97dcf69943b44b56052
Author: Xiang Xiao <[email protected]>
AuthorDate: Tue Aug 3 14:16:33 2021 +0800

    Fix variable 'catd' is used uninitialized whenever 'if' condition is false
    
    Signed-off-by: Xiang Xiao <[email protected]>
---
 libs/libc/locale/lib_catalog.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libs/libc/locale/lib_catalog.c b/libs/libc/locale/lib_catalog.c
index 32f8614..0dbb1a0 100644
--- a/libs/libc/locale/lib_catalog.c
+++ b/libs/libc/locale/lib_catalog.c
@@ -79,14 +79,14 @@ struct catmsg_s
 static nl_catd catmap(FAR const char *path)
 {
   FAR const struct cathdr_s *hdr;
+  nl_catd catd = MAP_FAILED;
   struct stat st;
-  nl_catd catd;
   int fd;
 
   fd = open(path, O_RDONLY | O_CLOEXEC);
   if (fd < 0)
     {
-      return MAP_FAILED;
+      return catd;
     }
 
   if (fstat(fd, &st) >= 0)

Reply via email to