* [PATCH] afs/super.c: Fix memory leak in afs_init_fs_context
@ 2018-06-20 13:19 Gustavo A. R. Silva
2018-06-22 11:21 ` David Howells
0 siblings, 1 reply; 2+ messages in thread
From: Gustavo A. R. Silva @ 2018-06-20 13:19 UTC (permalink / raw)
To: David Howells; +Cc: linux-afs, linux-kernel, Gustavo A. R. Silva
Release resources allocated for *ctx* before return.
Addresses-Coverity-ID: 1470101 ("Resource leak")
Fixes: 1ec2b51af007 ("afs: Add fs_context support")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
fs/afs/super.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/afs/super.c b/fs/afs/super.c
index 656f810..037f20f 100644
--- a/fs/afs/super.c
+++ b/fs/afs/super.c
@@ -596,8 +596,10 @@ static int afs_init_fs_context(struct fs_context *fc, struct dentry *reference)
break;
case FS_CONTEXT_FOR_SUBMOUNT:
- if (!reference)
+ if (!reference) {
+ kfree(ctx);
return -EINVAL;
+ }
src_as = AFS_FS_S(reference->d_sb);
ASSERT(src_as);
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-06-22 11:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-20 13:19 [PATCH] afs/super.c: Fix memory leak in afs_init_fs_context Gustavo A. R. Silva
2018-06-22 11:21 ` David Howells
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.