From nobody Sun May 5 02:02:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594641841; cv=none; d=zohomail.com; s=zohoarc; b=fMIFcolWSVcet6N50ACLeEMkOkQ7sJHyq2pnRg9KADLIQnD4QRDX594Ka2XrGgkyy4fyGMzDF66oWItTaU0ncJ2pR9YPTj4h29kTkX3LhqtE3F7CJkpU0hxijOjJSD/9QLcfQp296yerCd5w1SoV346RFbtt2zx/0T9SlFimJ9U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594641841; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=FC7OSSo876reazibvZwDLvYvZ8CR245N6UHrHWONNVo=; b=Tf9eN8Fw61mb5mT2yfpUTZz4sebEiCxgkAQLTtFjP0BJCedQQdFBBDQ0EkG/uOPHHB64mgkoiMbdmIHEfe04yLw/NyMPtVTOQ8OTAKOmdXfjNQlTfEsS2EQVy58yQ+RiseHpwIMZET5/x86mMkI65EiZAOngGF7ymZZSFwkrFbc= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1594641841414425.94971440891527; Mon, 13 Jul 2020 05:04:01 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-288-ucdqyPBlPdy9wvpt3sc4hA-1; Mon, 13 Jul 2020 08:03:57 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 590831088; Mon, 13 Jul 2020 12:03:52 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 14CC060C84; Mon, 13 Jul 2020 12:03:50 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 16B44180954D; Mon, 13 Jul 2020 12:03:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06D9sqbU006743 for ; Mon, 13 Jul 2020 05:54:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 181CD10CD91D; Mon, 13 Jul 2020 09:54:52 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1250310CD91A for ; Mon, 13 Jul 2020 09:54:49 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 320AD80CC37 for ; Mon, 13 Jul 2020 09:54:49 +0000 (UTC) Received: from huawei.com (szxga07-in.huawei.com [45.249.212.35]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-162-fHssNcXsMJe_HpxV1KZwRg-1; Mon, 13 Jul 2020 05:54:46 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id C5877C0B5C1022B468BD for ; Mon, 13 Jul 2020 17:39:31 +0800 (CST) Received: from [127.0.0.1] (10.174.187.239) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.487.0; Mon, 13 Jul 2020 17:39:29 +0800 X-MC-Unique: ucdqyPBlPdy9wvpt3sc4hA-1 X-MC-Unique: fHssNcXsMJe_HpxV1KZwRg-1 To: From: Jin Yan Subject: [PATCH] qemu: fix memleaks in qemuDomainAttachDeviceLive() Message-ID: <33408dc5-4e22-d89a-74cf-0c192d64f6ab@huawei.com> Date: Mon, 13 Jul 2020 17:39:28 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 Content-Language: en-US X-Originating-IP: [10.174.187.239] X-CFilter-Loop: Reflected X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 06D9sqbU006743 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Mon, 13 Jul 2020 08:03:48 -0400 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: quoted-printable From e46e168f9767b8b291f23217fc7a62163c82eaf8 Mon Sep 17 00:00:00 2001 From: Jin Yan Date: Tue, 7 Jul 2020 21:58:52 +0800 Subject: [PATCH] qemu: fix memleaks in qemuDomainAttachDeviceLive() During disk hotplugging, qemuDomainAttachDeviceLive() add the new disk to the device list of the VM object. However, hotplugging cdroms and floppies only updates the src variable of the original disk device, so the newly generated disk object needs to be released. Signed-off-by: Jin Yan Reviewed-by: Michal Privoznik --- =C2=A0src/qemu/qemu_hotplug.c | 1 + =C2=A01 file changed, 1 insertion(+) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 3954ad1109..40092b499d 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1115,6 +1115,7 @@ qemuDomainAttachDeviceDiskLive(virQEMUDriverPtr=20 driver, =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 r= eturn -1; =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 disk->src =3D NULL; +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 virDomainDiskDefFree(disk); =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return 0; =C2=A0=C2=A0=C2=A0=C2=A0 } --=20