]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
vbox: Reset @ret after xmlFreeNode
authorJohn Ferlan <jferlan@redhat.com>
Mon, 16 Dec 2019 12:36:32 +0000 (07:36 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Wed, 18 Dec 2019 22:21:51 +0000 (17:21 -0500)
In the error path, if we xmlFreeNode @ret, then the return ret;
a few lines later returns something that's already been free'd
and could be reused, so let's reinit it.

Found by Coverity

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/vbox/vbox_snapshot_conf.c

index 5a0abd6d0e1f3419be9c26b356c412630d2180a8..db6c389a64e82dde9667fbc2e8db8cf6109a72dd 100644 (file)
@@ -352,6 +352,7 @@ virVBoxSnapshotConfCreateHardDiskNode(virVBoxSnapshotConfHardDiskPtr hardDisk)
     if (result < 0) {
         xmlUnlinkNode(ret);
         xmlFreeNode(ret);
+        ret = NULL;
     }
     VIR_FREE(uuid);
     return ret;