aboutsummaryrefslogtreecommitdiff
path: root/hw/9pfs/9p-local.c
diff options
context:
space:
mode:
authorJiajun Chen <chenjiajun8@huawei.com>2020-01-20 15:11:39 +0100
committerMichael Roth <mdroth@linux.vnet.ibm.com>2020-06-16 17:21:13 -0500
commit18f6b13e085fdb81f5385bffce35364ab8535303 (patch)
tree731b96bb54a3276669e0d27e5bb98c51b4b2df40 /hw/9pfs/9p-local.c
parent6c75ddf4a9f317f038a4d94da1b2989fef5dd93b (diff)
downloadqemu-18f6b13e085fdb81f5385bffce35364ab8535303.zip
qemu-18f6b13e085fdb81f5385bffce35364ab8535303.tar.gz
qemu-18f6b13e085fdb81f5385bffce35364ab8535303.tar.bz2
9pfs: local: Fix possible memory leak in local_link()
There is a possible memory leak while local_link return -1 without free odirpath and oname. Reported-by: Euler Robot <euler.robot@huawei.com> Signed-off-by: Jaijun Chen <chenjiajun8@huawei.com> Signed-off-by: Xiang Zheng <zhengxiang9@huawei.com> Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Greg Kurz <groug@kaod.org> (cherry picked from commit 841b8d099c462cd4282c4ced8c2a6512899fd8d9) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Diffstat (limited to 'hw/9pfs/9p-local.c')
-rw-r--r--hw/9pfs/9p-local.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c
index 4708c0b..491b08a 100644
--- a/hw/9pfs/9p-local.c
+++ b/hw/9pfs/9p-local.c
@@ -947,7 +947,7 @@ static int local_link(FsContext *ctx, V9fsPath *oldpath,
if (ctx->export_flags & V9FS_SM_MAPPED_FILE &&
local_is_mapped_file_metadata(ctx, name)) {
errno = EINVAL;
- return -1;
+ goto out;
}
odirfd = local_opendir_nofollow(ctx, odirpath);