Skip to content
Snippets Groups Projects
Commit 0317724e authored by Tom Rini's avatar Tom Rini Committed by Simon Glass
Browse files

sandboxfs: Fix resource leak


Now that we free resources in sandbox_fs_ls Coverity is letting us know
that in some cases we might leak.  So in case of error we should still
let os_dirent_free free anything that was allocated.

Fixes: 86167089 ("sandbox/fs: Free memory allocated by os_dirent_ls")
Reported-by: Coverity (CID: 153450)
Cc: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: default avatarTom Rini <trini@konsulko.com>
Reviewed-by: default avatarSimon Glass <sjg@chromium.org>
parent a982b6f5
No related branches found
No related tags found
No related merge requests found
...@@ -88,15 +88,16 @@ int sandbox_fs_ls(const char *dirname) ...@@ -88,15 +88,16 @@ int sandbox_fs_ls(const char *dirname)
ret = os_dirent_ls(dirname, &head); ret = os_dirent_ls(dirname, &head);
if (ret) if (ret)
return ret; goto out;
for (node = head; node; node = node->next) { for (node = head; node; node = node->next) {
printf("%s %10lu %s\n", os_dirent_get_typename(node->type), printf("%s %10lu %s\n", os_dirent_get_typename(node->type),
node->size, node->name); node->size, node->name);
} }
out:
os_dirent_free(head); os_dirent_free(head);
return 0; return ret;
} }
int sandbox_fs_exists(const char *filename) int sandbox_fs_exists(const char *filename)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment