]> git.proxmox.com Git - mirror_qemu.git/commitdiff
9pfs: local: Fix possible memory leak in local_link()
authorJiajun Chen <chenjiajun8@huawei.com>
Mon, 20 Jan 2020 14:11:39 +0000 (15:11 +0100)
committerGreg Kurz <groug@kaod.org>
Mon, 20 Jan 2020 14:11:39 +0000 (15:11 +0100)
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>
hw/9pfs/9p-local.c

index ca641390fbca4537fb2baefb5c3eebf3cd2aa65d..d0592c3b4504a7f3e474364c9910909fd962484c 100644 (file)
@@ -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);