From: Cong Ding <dinggnu@gmail.com>
To: Steve French <sfrench@samba.org>,
linux-cifs@vger.kernel.org, samba-technical@lists.samba.org,
linux-kernel@vger.kernel.org
Cc: Cong Ding <dinggnu@gmail.com>
Subject: [PATCH] fs/cifs/cifs_dfs_ref.c: fix potential memory leakage
Date: Tue, 22 Jan 2013 19:20:58 -0500 [thread overview]
Message-ID: <1358900459-26277-1-git-send-email-dinggnu@gmail.com> (raw)
When it goes to error through line 144, the memory allocated to *devname is
not freed, and the caller doesn't free it either in line 250. So we free the
memroy of *devname in function cifs_compose_mount_options() when it goes to
error.
Signed-off-by: Cong Ding <dinggnu@gmail.com>
---
fs/cifs/cifs_dfs_ref.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c
index ce5cbd7..210fce2 100644
--- a/fs/cifs/cifs_dfs_ref.c
+++ b/fs/cifs/cifs_dfs_ref.c
@@ -226,6 +226,8 @@ compose_mount_options_out:
compose_mount_options_err:
kfree(mountdata);
mountdata = ERR_PTR(rc);
+ kfree(*devname);
+ *devname = NULL;
goto compose_mount_options_out;
}
--
1.7.10.4
next reply other threads:[~2013-01-23 0:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-23 0:20 Cong Ding [this message]
[not found] ` <1358900459-26277-1-git-send-email-dinggnu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-01-23 1:36 ` [PATCH] fs/cifs/cifs_dfs_ref.c: fix potential memory leakage Jeff Layton
2013-01-23 1:36 ` Jeff Layton
[not found] ` <20130122203603.1bd26363-4QP7MXygkU+dMjc06nkz3ljfA9RmPOcC@public.gmane.org>
2013-01-23 5:59 ` Steve French
2013-01-23 5:59 ` Steve French
[not found] ` <CAH2r5mtSTOWc7Caf3UA=SGY3_PoR-xFOyXHd4OiYZSGXa5W_YQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-01-23 6:00 ` Steve French
2013-01-23 6:00 ` Steve French
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1358900459-26277-1-git-send-email-dinggnu@gmail.com \
--to=dinggnu@gmail.com \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=samba-technical@lists.samba.org \
--cc=sfrench@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.