cifs: Fix memory leak in cifs_hardlink()

Fix a potential memory leak in the cifs_hardlink() error handling path.
Detected by Coverity: CID 728510, CID 728511.

Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
Signed-off-by: Steve French <smfrench@gmail.com>
This commit is contained in:
Christian Engelmayer 2014-01-11 01:57:22 +01:00 коммит произвёл Steve French
Родитель d8ec26d7f8
Коммит abf9767c82
1 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -438,8 +438,10 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode,
CIFS_MOUNT_MAP_SPECIAL_CHR); CIFS_MOUNT_MAP_SPECIAL_CHR);
else { else {
server = tcon->ses->server; server = tcon->ses->server;
if (!server->ops->create_hardlink) if (!server->ops->create_hardlink) {
return -ENOSYS; rc = -ENOSYS;
goto cifs_hl_exit;
}
rc = server->ops->create_hardlink(xid, tcon, from_name, to_name, rc = server->ops->create_hardlink(xid, tcon, from_name, to_name,
cifs_sb); cifs_sb);
if ((rc == -EIO) || (rc == -EINVAL)) if ((rc == -EIO) || (rc == -EINVAL))