From: Pavel Hrdina Date: Mon, 27 May 2024 17:14:00 +0000 (+0200) Subject: qemu_snapshot: fix memory leak when reverting external snapshot X-Git-Tag: v10.4.0-rc2~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2ea493598fd5a3efe4f25d842b2f09bc5c74c6c1;p=thirdparty%2Flibvirt.git qemu_snapshot: fix memory leak when reverting external snapshot 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 --- 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); } + virStorageSourceDeinit(snapdisk->src); + virDomainSnapshotDiskDefClear(snapdisk); } @@ -2277,6 +2279,8 @@ qemuSnapshotRevertExternalFinish(virDomainObj *vm, VIR_WARN("Failed to remove snapshot image '%s'", snapdisk->src->path); } + + virStorageSourceDeinit(snapdisk->src); } }