Fix variable 'catd' is used uninitialized whenever 'if' condition is false

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2021-08-03 14:16:33 +08:00 committed by Alan Carvalho de Assis
parent c597721633
commit c6c1ec81e0

View File

@ -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)