All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cifs: Fix a tiny potential memory leak
@ 2019-01-05 18:18 Dan Carpenter
  2019-01-05 23:55 ` Steve French
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2019-01-05 18:18 UTC (permalink / raw)
  To: kernel-janitors

The most recent "it" allocation is leaked on this error path.  I
believe that small allocations always succeed in current kernels so
this doesn't really affect run time.

Fixes: 54be1f6c1c37 ("cifs: Add DFS cache routines")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 fs/cifs/dfs_cache.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/cifs/dfs_cache.c b/fs/cifs/dfs_cache.c
index cd63c4a70875..09b7d0d4f6e4 100644
--- a/fs/cifs/dfs_cache.c
+++ b/fs/cifs/dfs_cache.c
@@ -776,6 +776,7 @@ static int get_tgt_list(const struct dfs_cache_entry *ce,
 		it->it_name = kstrndup(t->t_name, strlen(t->t_name),
 				       GFP_KERNEL);
 		if (!it->it_name) {
+			kfree(it);
 			rc = -ENOMEM;
 			goto err_free_it;
 		}
--
2.17.1

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

* Re: [PATCH] cifs: Fix a tiny potential memory leak
  2019-01-05 18:18 [PATCH] cifs: Fix a tiny potential memory leak Dan Carpenter
@ 2019-01-05 23:55 ` Steve French
  0 siblings, 0 replies; 2+ messages in thread
From: Steve French @ 2019-01-05 23:55 UTC (permalink / raw)
  To: kernel-janitors

merged into cifs-2.6.git for-next

thx

On Sat, Jan 5, 2019 at 12:19 PM Dan Carpenter via samba-technical
<samba-technical@lists.samba.org> wrote:
>
> The most recent "it" allocation is leaked on this error path.  I
> believe that small allocations always succeed in current kernels so
> this doesn't really affect run time.
>
> Fixes: 54be1f6c1c37 ("cifs: Add DFS cache routines")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  fs/cifs/dfs_cache.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/fs/cifs/dfs_cache.c b/fs/cifs/dfs_cache.c
> index cd63c4a70875..09b7d0d4f6e4 100644
> --- a/fs/cifs/dfs_cache.c
> +++ b/fs/cifs/dfs_cache.c
> @@ -776,6 +776,7 @@ static int get_tgt_list(const struct dfs_cache_entry *ce,
>                 it->it_name = kstrndup(t->t_name, strlen(t->t_name),
>                                        GFP_KERNEL);
>                 if (!it->it_name) {
> +                       kfree(it);
>                         rc = -ENOMEM;
>                         goto err_free_it;
>                 }
> --
> 2.17.1
>


-- 
Thanks,

Steve

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

end of thread, other threads:[~2019-01-05 23:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-05 18:18 [PATCH] cifs: Fix a tiny potential memory leak Dan Carpenter
2019-01-05 23:55 ` Steve French

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.