qemu/scsi-disk-define-props-in-scsi_block_disk-to-avoid-memleaks.patch
xuding ed0d368182 Fix some memory leak in qemu
Signed-off-by: Ying Fang <fangying1@huawei.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
2020-01-13 20:40:08 +08:00

37 lines
1.3 KiB
Diff

From 79da8e2e18610ae22a3bd640c117ba56b911038d Mon Sep 17 00:00:00 2001
From: Pan Nengyuan <pannengyuan@huawei.com>
Date: Mon, 13 Jan 2020 15:53:32 +0800
Subject: [PATCH] scsi-disk: define props in scsi_block_disk to avoid
memleaks
scsi_block_realize() use scsi_realize() to init some props, but
these props is not defined in scsi_block_disk_properties, so they will
not be freed.
This patch defines these prop in scsi_block_disk_properties to avoid memleaks.
Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
---
hw/scsi/scsi-disk.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index e7e865ab..233afb4a 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -3026,9 +3026,7 @@ static const TypeInfo scsi_cd_info = {
#ifdef __linux__
static Property scsi_block_properties[] = {
- DEFINE_BLOCK_ERROR_PROPERTIES(SCSIDiskState, qdev.conf), \
- DEFINE_PROP_DRIVE("drive", SCSIDiskState, qdev.conf.blk),
- DEFINE_PROP_BOOL("share-rw", SCSIDiskState, qdev.conf.share_rw, false),
+ DEFINE_SCSI_DISK_PROPERTIES(),
DEFINE_PROP_UINT16("rotation_rate", SCSIDiskState, rotation_rate, 0),
DEFINE_PROP_UINT64("max_unmap_size", SCSIDiskState, max_unmap_size,
DEFAULT_MAX_UNMAP_SIZE),
--
2.18.1