You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2022/01/27 09:23:45 UTC
[incubator-nuttx] 01/02: symtab_findbyname: just retun NULL for NULL symtab
This is an automated email from the ASF dual-hosted git repository.
pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 0edb29095124acf39f532909710fef4642378136
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Thu Jan 27 13:22:37 2022 +0900
symtab_findbyname: just retun NULL for NULL symtab
The condition is not fatal at all.
It's better to let the caller handle the failure.
---
libs/libc/symtab/symtab_findbyname.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/libs/libc/symtab/symtab_findbyname.c b/libs/libc/symtab/symtab_findbyname.c
index d3bd0d0..7efa80c 100644
--- a/libs/libc/symtab/symtab_findbyname.c
+++ b/libs/libc/symtab/symtab_findbyname.c
@@ -60,6 +60,12 @@ symtab_findbyname(FAR const struct symtab_s *symtab,
int cmp;
#endif
+ if (symtab == NULL)
+ {
+ DEBUGASSERT(nsyms == 0);
+ return NULL;
+ }
+
#ifdef CONFIG_SYMTAB_DECORATED
if (name[0] == '_')
{
@@ -67,7 +73,7 @@ symtab_findbyname(FAR const struct symtab_s *symtab,
}
#endif
- DEBUGASSERT(symtab != NULL && name != NULL);
+ DEBUGASSERT(name != NULL);
#ifdef CONFIG_SYMTAB_ORDEREDBYNAME
while (low < high)