[PATCH 02/17] qemuSnapshotRedefine: Fix use of snapshot definition after free

Ján Tomko jtomko at redhat.com
Thu Jan 13 08:20:46 UTC 2022

On a Wednesday in 2022, Peter Krempa wrote:
>Commit f4aae9726df factored out the snapshot redefinition code into a
>separate function, but didn't account for the fact that the code is
>consuming the reference to the snapshot definition and by moving the
>code away the caller (qemuSnapshotCreateXML) now frees the definition
>which didn't happen before as we cleared the pointer.
>Fix it by increasing the reference locally. Later patches will refactor
>the code so that it's more obvious what's happening.
>Fixes: f4aae9726df
>Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2039651
>Signed-off-by: Peter Krempa <pkrempa at redhat.com>
> src/qemu/qemu_snapshot.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)

Reviewed-by: Ján Tomko <jtomko at redhat.com>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20220113/2321f166/attachment-0001.sig>

More information about the libvir-list mailing list