From nobody Sun May 5 01:00:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1628492836870245.96490410516276; Mon, 9 Aug 2021 00:07:16 -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-519-dU3VOG96PUuQrEgHeoOzOw-1; Mon, 09 Aug 2021 03:07:14 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0B0F1363A4; Mon, 9 Aug 2021 07:07:08 +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 0D2DA5D9D3; Mon, 9 Aug 2021 07:07:05 +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 1DC64180140E; Mon, 9 Aug 2021 07:07:00 +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 17974kmX006422 for ; Mon, 9 Aug 2021 03:04:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 51414110DBD9; Mon, 9 Aug 2021 07:04:46 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4D0A1110DBB6 for ; Mon, 9 Aug 2021 07:04:42 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6FA5D858EEC for ; Mon, 9 Aug 2021 07:04:42 +0000 (UTC) Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-184-MHzqHDJiNxqYKi3WbWsvmA-1; Mon, 09 Aug 2021 03:04:40 -0400 Received: by mail-pj1-f47.google.com with SMTP id lw7-20020a17090b1807b029017881cc80b7so6919341pjb.3 for ; Mon, 09 Aug 2021 00:04:40 -0700 (PDT) Received: from localhost ([103.138.53.99]) by smtp.gmail.com with ESMTPSA id u17sm18815666pfh.184.2021.08.09.00.04.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Aug 2021 00:04:38 -0700 (PDT) X-MC-Unique: dU3VOG96PUuQrEgHeoOzOw-1 X-MC-Unique: MHzqHDJiNxqYKi3WbWsvmA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=Tyt3iirMiJjR57aSRcHT6uIXO961uK35fCVUsYQtCgQ=; b=a3kRwFrxC+xpg6D2LMO1Ueym1KeTbKC2LeFJ1WQwjU8PqryeaiZGMHFpsUjAk4WvAp Orsf8bjj2nGtuehzQ7C0waK/WvdEVu1tQSVI46q1bod3byQHYxbE/qhm9PuV1Mdig8Pi Yc4pVqx00/HGNOpV/atJUdOK8IWNvwUstd0LUqO7LS//3sfOrud36aehdlM1EZBsnTZB blz5BE+2nljlTl6pdEjAm2fnS9PTAtjKauEMN5coowhV1iEQ/RwJLbTdeXmw7biBkESi u/JlIfYtq5YGgBoayxeRDx0MGDFJimbqnX0wezX+UKeoysdOQB4ZT2eBnYraNUkF7Ebs ADDg== X-Gm-Message-State: AOAM531T1CWRaEZeDaU5TTolurZF7sK1LH281oF3Q77ZuzWWGJDHzcl7 k/TlXBhQvNJYIHkV8iB0d2/mnPdxD+lwtD1FIssCaA== X-Google-Smtp-Source: ABdhPJx1MHZqi7vsV6XlpkX25sCwgDDDc+5CGKypNs6O48O7JJxH4C2V8qRltUmwwFuIodNQ51vfDQ== X-Received: by 2002:a17:90a:f486:: with SMTP id bx6mr23666788pjb.26.1628492678991; Mon, 09 Aug 2021 00:04:38 -0700 (PDT) From: Luke Yue To: libvir-list@redhat.com Subject: [PATCH] domain_conf: Fix memory leak when free'ing virDomainObj Date: Mon, 9 Aug 2021 15:04:35 +0800 Message-Id: <20210809070435.205173-1-lukedyue@gmail.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com 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.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1628492838813100001 Content-Type: text/plain; charset="utf-8" Free dom->deprecations when free'ing virDomainObj Signed-off-by: Luke Yue --- src/conf/domain_conf.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 09da4ab952..2527cd1d70 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3733,6 +3733,7 @@ void virDomainDefFree(virDomainDef *def) static void virDomainObjDispose(void *obj) { virDomainObj *dom =3D obj; + size_t i =3D 0; =20 VIR_DEBUG("obj=3D%p", dom); virCondDestroy(&dom->cond); @@ -3742,6 +3743,11 @@ static void virDomainObjDispose(void *obj) if (dom->privateDataFreeFunc) (dom->privateDataFreeFunc)(dom->privateData); =20 + for (i =3D 0; i < dom->ndeprecations; i++) { + g_free(dom->deprecations[i]); + } + g_free(dom->deprecations); + virDomainSnapshotObjListFree(dom->snapshots); virDomainCheckpointObjListFree(dom->checkpoints); } --=20 2.32.0