From nobody Fri Oct 18 06:19:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 171683300273759.66254977608094; Mon, 27 May 2024 11:03:22 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 87996192E; Mon, 27 May 2024 14:03:21 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 99EB21A40; Mon, 27 May 2024 14:02:53 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id AD9A8192E; Mon, 27 May 2024 14:02:50 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 489531940 for ; Mon, 27 May 2024 14:02:50 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-612-cS5PVrYBMduSUPn8rG7Y6Q-1; Mon, 27 May 2024 14:02:48 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 682FD3C025B5 for ; Mon, 27 May 2024 18:02:48 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0DF71286E for ; Mon, 27 May 2024 18:02:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716832969; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RabWY2rG+qlBW+kPPDPGhfSzGSV5zceVFUzBn+U7ZaA=; b=e+WoiSz1VYUzwXYj7+xW75/5FlyLJ9P5h4QTcXMjyj0vFPb54deydFo9+uagn0/0v64kKJ ghr0DyZwwtpxCPm07buyZJNcy/5lBV5lsX+dzISDPfFSZqbCOspyOYHRhAH+cBhTpDGEWM +O+SxEIURlAaUupUOVt1EaZQgnTn7dE= X-MC-Unique: cS5PVrYBMduSUPn8rG7Y6Q-1 From: Pavel Hrdina To: devel@lists.libvirt.org Subject: [libvirt PATCH] qemu_snapshot: fix memory leak when reverting external snapshot Date: Mon, 27 May 2024 20:02:39 +0200 Message-ID: <5c6b31ad74da2c67526fe17c2907d8c8478d7be9.1716832935.git.phrdina@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: IXHM2PNP2L5H52O3MOP3TJBNP34KDRDP X-Message-ID-Hash: IXHM2PNP2L5H52O3MOP3TJBNP34KDRDP X-MailFrom: phrdina@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1716833004808100001 Content-Type: text/plain; charset="utf-8"; x-default="true" The code cleaning up virStorageSource doesn't free data allocated by virStorageSourceInit() so we need to call virStorageSourceDeinit() explicitly. Fixes: 8e664737813378d2a1bdeacc2ca8e942327e2cab Resolves: https://issues.redhat.com/browse/RHEL-33044 Signed-off-by: Pavel Hrdina Reviewed-by: Jiri Denemark --- src/qemu/qemu_snapshot.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 09ec959f10..f5260c4a22 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -2260,6 +2260,8 @@ qemuSnapshotRevertExternalFinish(virDomainObj *vm, snapdisk->src->path); } =20 + virStorageSourceDeinit(snapdisk->src); + virDomainSnapshotDiskDefClear(snapdisk); } =20 @@ -2277,6 +2279,8 @@ qemuSnapshotRevertExternalFinish(virDomainObj *vm, VIR_WARN("Failed to remove snapshot image '%s'", snapdisk->src->path); } + + virStorageSourceDeinit(snapdisk->src); } } =20 --=20 2.45.1