mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-02 20:59:05 +00:00
In function ‘passwd_find’:
passwd_find.c:82:14: warning: leak of ‘iobuffer’ [CWE-401] [-Wanalyzer-malloc-leak]
82 | return -errcode;
| ^~~~~~~~
‘passwd_find’: events 1-5
|
| 65 | iobuffer = (FAR char *)malloc(CONFIG_FSUTILS_PASSWD_IOBUFFER_SIZE);
| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (1) allocated here
| 66 | if (iobuffer == NULL)
| | ~
| | |
| | (2) assuming ‘iobuffer’ is non-NULL
| | (3) following ‘false’ branch (when ‘iobuffer’ is non-NULL)...
|......
| 73 | stream = fopen(CONFIG_FSUTILS_PASSWD_PATH, "r");
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (4) ...to here
| 74 | if (stream == NULL)
| | ~
| | |
| | (5) following ‘true’ branch (when ‘stream’ is NULL)...
|
‘passwd_find’: event 6
|
| 80 | int errcode = errno;
| | ^~~~~
| | |
| | (6) ...to here
|
‘passwd_find’: event 7
|
| 82 | return -errcode;
| | ^~~~~~~~
| | |
| | (7) ‘iobuffer’ leaks here; was allocated at (1)
|
Signed-off-by: Junbo Zheng <zhengjunbo1@xiaomi.com>
|
||
|---|---|---|
| .. | ||
| Kconfig | ||
| Make.defs | ||
| Makefile | ||
| passwd.h | ||
| passwd_adduser.c | ||
| passwd_append.c | ||
| passwd_delete.c | ||
| passwd_deluser.c | ||
| passwd_encrypt.c | ||
| passwd_find.c | ||
| passwd_lock.c | ||
| passwd_update.c | ||
| passwd_verify.c | ||