mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-11 07:34:31 +00:00
sandbox: terminate os_dirent_ls() result list
Each node in the linked-list that os_dirent_ls() returns has its next pointer set only when the next node is created. For the last node in the list, there is no next node, so this never happens, and the next pointer is never initialized. Explicitly initialize the next pointer so that it isn't dangling. Without this, "sb ls" might crash. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
4d907025d6
commit
9c38c07008
1 changed files with 1 additions and 0 deletions
|
@ -341,6 +341,7 @@ int os_dirent_ls(const char *dirname, struct os_dirent_node **headp)
|
|||
ret = -ENOMEM;
|
||||
goto done;
|
||||
}
|
||||
next->next = NULL;
|
||||
strcpy(next->name, entry.d_name);
|
||||
switch (entry.d_type) {
|
||||
case DT_REG:
|
||||
|
|
Loading…
Reference in a new issue