All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] sandboxfs: Fix resource leak
@ 2016-10-18  1:09 Tom Rini
  2016-10-18  1:54 ` Simon Glass
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Rini @ 2016-10-18  1:09 UTC (permalink / raw)
  To: u-boot

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: 86167089b71c ("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: Tom Rini <trini@konsulko.com>
---
 fs/sandbox/sandboxfs.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/sandbox/sandboxfs.c b/fs/sandbox/sandboxfs.c
index cd10fd6845fb..ca8026133708 100644
--- a/fs/sandbox/sandboxfs.c
+++ b/fs/sandbox/sandboxfs.c
@@ -88,15 +88,16 @@ int sandbox_fs_ls(const char *dirname)
 
 	ret = os_dirent_ls(dirname, &head);
 	if (ret)
-		return ret;
+		goto out;
 
 	for (node = head; node; node = node->next) {
 		printf("%s %10lu %s\n", os_dirent_get_typename(node->type),
 		       node->size, node->name);
 	}
+out:
 	os_dirent_free(head);
 
-	return 0;
+	return ret;
 }
 
 int sandbox_fs_exists(const char *filename)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] sandboxfs: Fix resource leak
  2016-10-18  1:09 [U-Boot] [PATCH] sandboxfs: Fix resource leak Tom Rini
@ 2016-10-18  1:54 ` Simon Glass
  2016-10-25 18:39   ` Simon Glass
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Glass @ 2016-10-18  1:54 UTC (permalink / raw)
  To: u-boot

On 17 October 2016 at 19:09, Tom Rini <trini@konsulko.com> wrote:
> 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: 86167089b71c ("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: Tom Rini <trini@konsulko.com>
> ---
>  fs/sandbox/sandboxfs.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] sandboxfs: Fix resource leak
  2016-10-18  1:54 ` Simon Glass
@ 2016-10-25 18:39   ` Simon Glass
  0 siblings, 0 replies; 3+ messages in thread
From: Simon Glass @ 2016-10-25 18:39 UTC (permalink / raw)
  To: u-boot

On 17 October 2016 at 19:54, Simon Glass <sjg@chromium.org> wrote:
> On 17 October 2016 at 19:09, Tom Rini <trini@konsulko.com> wrote:
>> 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: 86167089b71c ("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: Tom Rini <trini@konsulko.com>
>> ---
>>  fs/sandbox/sandboxfs.c | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm/next, thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-10-25 18:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-18  1:09 [U-Boot] [PATCH] sandboxfs: Fix resource leak Tom Rini
2016-10-18  1:54 ` Simon Glass
2016-10-25 18:39   ` Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.