diff options
author | Krishna Kumar <krkumar2@in.ibm.com> | 2008-10-22 14:48:36 +0530 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2008-10-22 14:00:45 -0400 |
commit | 6c6a426fdcb374b7641d7cf9eea88410828b9d9a (patch) | |
tree | 4792b7c2343c5b9acd07e5ceb40d7cdeee49ebb8 /fs/nfsd | |
parent | 1cd9cd161c89f569b90583b7797bd972c3bf0cff (diff) | |
download | op-kernel-dev-6c6a426fdcb374b7641d7cf9eea88410828b9d9a.zip op-kernel-dev-6c6a426fdcb374b7641d7cf9eea88410828b9d9a.tar.gz |
nfsd: Fix memory leak in nfsd_getxattr
Fix a memory leak in nfsd_getxattr. nfsd_getxattr should free up memory
that it allocated if vfs_getxattr fails.
Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/vfs.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index aa1d0d6..9609eb5 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -410,6 +410,7 @@ out_nfserr: static ssize_t nfsd_getxattr(struct dentry *dentry, char *key, void **buf) { ssize_t buflen; + ssize_t ret; buflen = vfs_getxattr(dentry, key, NULL, 0); if (buflen <= 0) @@ -419,7 +420,10 @@ static ssize_t nfsd_getxattr(struct dentry *dentry, char *key, void **buf) if (!*buf) return -ENOMEM; - return vfs_getxattr(dentry, key, *buf, buflen); + ret = vfs_getxattr(dentry, key, *buf, buflen); + if (ret < 0) + kfree(*buf); + return ret; } #endif |