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: 8e66473781
Resolves: https://issues.redhat.com/browse/RHEL-33044
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Pavel Hrdina 2024-05-27 19:14:00 +02:00
parent 38c6c36408
commit 2ea493598f

View File

@ -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);
}
}