Skip to content

Commit

Permalink
fs/9p, net/9p: memory leak fixes
Browse files Browse the repository at this point in the history
Four memory leak fixes in the 9P code.

Signed-off-by: Latchesar Ionkov <lucho@ionkov.net>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
  • Loading branch information
Latchesar Ionkov authored and Eric Van Hensbergen committed Sep 13, 2010
1 parent 49553c2 commit 62b2be5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions fs/9p/vfs_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,7 @@ v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
v9fs_stat2inode(st, dentry->d_inode, dentry->d_inode->i_sb);
generic_fillattr(dentry->d_inode, stat);

p9stat_free(st);
kfree(st);
return 0;
}
Expand Down Expand Up @@ -1489,6 +1490,7 @@ static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen)

retval = strnlen(buffer, buflen);
done:
p9stat_free(st);
kfree(st);
return retval;
}
Expand Down
7 changes: 6 additions & 1 deletion net/9p/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/* free requests associated with tags */
for (row = 0; row < (c->max_tag/P9_ROW_MAXTAG); row++) {
Expand Down Expand Up @@ -944,6 +946,7 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid, int nwname, char **wnames,
int16_t nwqids, count;

err = 0;
wqids = NULL;
clnt = oldfid->clnt;
if (clone) {
fid = p9_fid_create(clnt);
Expand Down Expand Up @@ -994,9 +997,11 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid, int nwname, char **wnames,
else
fid->qid = oldfid->qid;

kfree(wqids);
return fid;

clunk_fid:
kfree(wqids);
p9_client_clunk(fid);
fid = NULL;

Expand Down

0 comments on commit 62b2be5

Please sign in to comment.