Commit 62b2be59 authored by Latchesar Ionkov's avatar Latchesar Ionkov Committed by Eric Van Hensbergen

fs/9p, net/9p: memory leak fixes

Four memory leak fixes in the 9P code.
Signed-off-by: default avatarLatchesar Ionkov <lucho@ionkov.net>
Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
parent 49553c2e
...@@ -1128,6 +1128,7 @@ v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry, ...@@ -1128,6 +1128,7 @@ v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
v9fs_stat2inode(st, dentry->d_inode, dentry->d_inode->i_sb); v9fs_stat2inode(st, dentry->d_inode, dentry->d_inode->i_sb);
generic_fillattr(dentry->d_inode, stat); generic_fillattr(dentry->d_inode, stat);
p9stat_free(st);
kfree(st); kfree(st);
return 0; return 0;
} }
...@@ -1489,6 +1490,7 @@ static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen) ...@@ -1489,6 +1490,7 @@ static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen)
retval = strnlen(buffer, buflen); retval = strnlen(buffer, buflen);
done: done:
p9stat_free(st);
kfree(st); kfree(st);
return retval; return retval;
} }
......
...@@ -331,8 +331,10 @@ static void p9_tag_cleanup(struct p9_client *c) ...@@ -331,8 +331,10 @@ static void p9_tag_cleanup(struct p9_client *c)
} }
} }
if (c->tagpool) if (c->tagpool) {
p9_idpool_put(0, c->tagpool); /* free reserved tag 0 */
p9_idpool_destroy(c->tagpool); p9_idpool_destroy(c->tagpool);
}
/* free requests associated with tags */ /* free requests associated with tags */
for (row = 0; row < (c->max_tag/P9_ROW_MAXTAG); row++) { for (row = 0; row < (c->max_tag/P9_ROW_MAXTAG); row++) {
...@@ -944,6 +946,7 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid, int nwname, char **wnames, ...@@ -944,6 +946,7 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid, int nwname, char **wnames,
int16_t nwqids, count; int16_t nwqids, count;
err = 0; err = 0;
wqids = NULL;
clnt = oldfid->clnt; clnt = oldfid->clnt;
if (clone) { if (clone) {
fid = p9_fid_create(clnt); fid = p9_fid_create(clnt);
...@@ -994,9 +997,11 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid, int nwname, char **wnames, ...@@ -994,9 +997,11 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid, int nwname, char **wnames,
else else
fid->qid = oldfid->qid; fid->qid = oldfid->qid;
kfree(wqids);
return fid; return fid;
clunk_fid: clunk_fid:
kfree(wqids);
p9_client_clunk(fid); p9_client_clunk(fid);
fid = NULL; fid = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment