From nobody Mon Apr 29 09:10:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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 [170.10.133.124]) by mx.zohomail.com with SMTPS id 1628603271848585.7490101940217; Tue, 10 Aug 2021 06:47:51 -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-116-vFfPOvq6MK-0Hq6jjwYSMg-1; Tue, 10 Aug 2021 09:47:48 -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 AA54A100E426; Tue, 10 Aug 2021 13:47:36 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 64EFC60CD1; Tue, 10 Aug 2021 13:47:35 +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 DC2434BB7C; Tue, 10 Aug 2021 13:47:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17ADlWsV023220 for ; Tue, 10 Aug 2021 09:47:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 34FB3200D8F7; Tue, 10 Aug 2021 13:47:32 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 30DD5200B684 for ; Tue, 10 Aug 2021 13:47:28 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (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 B146C8D138C for ; Tue, 10 Aug 2021 13:47:28 +0000 (UTC) Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-39-f4vCPwx5Mp-H7n5HGPvCVw-1; Tue, 10 Aug 2021 09:47:26 -0400 Received: by mail-pj1-f54.google.com with SMTP id lw7-20020a17090b1807b029017881cc80b7so4427428pjb.3 for ; Tue, 10 Aug 2021 06:47:26 -0700 (PDT) Received: from localhost ([103.138.53.99]) by smtp.gmail.com with ESMTPSA id c26sm17834023pfo.3.2021.08.10.06.47.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Aug 2021 06:47:24 -0700 (PDT) X-MC-Unique: vFfPOvq6MK-0Hq6jjwYSMg-1 X-MC-Unique: f4vCPwx5Mp-H7n5HGPvCVw-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=ZNEM8BDPnGYDe2zPRzu5r+jlwaH29uYJSQFeIFH8oLk=; b=D6ItYY3FW07FFHlOPu9/5JU+xzc4cbtnYXUI5uj9DPRmRFf0xFTl91hgc2k2l1PW/x 4TDK/55OtyJ3JXnRqX8BOAujlwHhO4KsrNARClvy9Cy9bp40B437wyrcDwqbXFF4LuNB YZvxZSVQNTYoP0FN68nbzyZtseSPL95/CGIWsMyZmbktYuCMigbhXnwnDBskUdPVlne9 tbtEHFzHXcb8iHL4KWlSg2M1Cq1b5rE1LPUuHPbmfI20YobP4zCpKk1AIi5iuU524yGc 7rjyaPB/hTdAAn+WMml6Ui/axUjY/5h7UkfcsDWX/wpo0tbyS/TC968+BGWHx56BWeL3 LBgg== X-Gm-Message-State: AOAM532H+UIBT/nqr3QY1RJzD3l7YzA5Naanok/NxDdQt8i4VlNUr5Y3 4TuffaRwwCYwDrS1f7YxoFI5pZ7WeUXQMGIEhHhBSw== X-Google-Smtp-Source: ABdhPJxu2zA9J7U/zFqcJoMUgatuDrq0Mn0AWp55YyiRrvIfP/3NhVRgyLXIozTB8OATLFxn+hyyyg== X-Received: by 2002:a63:dc03:: with SMTP id s3mr183430pgg.88.1628603245258; Tue, 10 Aug 2021 06:47:25 -0700 (PDT) From: Luke Yue To: libvir-list@redhat.com Subject: [PATCH v2] domain_conf: Fix memory leak when free'ing virDomainObj Date: Tue, 10 Aug 2021 21:47:21 +0800 Message-Id: <20210810134721.106715-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.4 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.12 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: 1628603272819100001 Content-Type: text/plain; charset="utf-8" Free dom->deprecations when free'ing virDomainObj Signed-off-by: Luke Yue Reviewed-by: Pavel Hrdina --- src/conf/domain_conf.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 09da4ab952..7e1d30bdb2 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3730,6 +3730,16 @@ void virDomainDefFree(virDomainDef *def) g_free(def); } =20 +static void +virDomainObjDeprecationFree(virDomainObj *dom) +{ + size_t i =3D 0; + for (i =3D 0; i < dom->ndeprecations; i++) { + g_free(dom->deprecations[i]); + } + g_free(dom->deprecations); +} + static void virDomainObjDispose(void *obj) { virDomainObj *dom =3D obj; @@ -3742,6 +3752,7 @@ static void virDomainObjDispose(void *obj) if (dom->privateDataFreeFunc) (dom->privateDataFreeFunc)(dom->privateData); =20 + virDomainObjDeprecationFree(dom); virDomainSnapshotObjListFree(dom->snapshots); virDomainCheckpointObjListFree(dom->checkpoints); } --=20 2.32.0