mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-10-20 12:55:43 +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;
|
int ret;
|
||||||
|
|
||||||
DEBUGASSERT(pstate != NULL);
|
DEBUGASSERT(pstate != NULL);
|
||||||
|
if (pstate == NULL)
|
||||||
|
{
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
/* Execute the session */
|
/* Execute the session */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user