mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-10-19 19:44:35 +08:00
nshlib/nsh_consolemain: detect null pointer
Returning with an error from nsh_consolemain prevents dereferencing a NULL pointer later in the code.
This commit is contained in:

committed by
Xiang Xiao

parent
7981278021
commit
78a6d07a90
@@ -65,6 +65,10 @@ int nsh_consolemain(int argc, FAR char *argv[])
|
||||
int ret;
|
||||
|
||||
DEBUGASSERT(pstate != NULL);
|
||||
if (pstate == NULL)
|
||||
{
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/* Execute the session */
|
||||
|
||||
|
Reference in New Issue
Block a user