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 <jfer...@redhat.com>
---
 src/vbox/vbox_snapshot_conf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/vbox/vbox_snapshot_conf.c b/src/vbox/vbox_snapshot_conf.c
index 5a0abd6d0e..db6c389a64 100644
--- a/src/vbox/vbox_snapshot_conf.c
+++ b/src/vbox/vbox_snapshot_conf.c
@@ -352,6 +352,7 @@ 
virVBoxSnapshotConfCreateHardDiskNode(virVBoxSnapshotConfHardDiskPtr hardDisk)
     if (result < 0) {
         xmlUnlinkNode(ret);
         xmlFreeNode(ret);
+        ret = NULL;
     }
     VIR_FREE(uuid);
     return ret;
-- 
2.23.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to