[libvirt] [PATCH 2/3] vbox: Reset @ret after xmlFreeNode

John Ferlan jferlan at redhat.com
Tue Dec 17 20:30:03 UTC 2019


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 at 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




More information about the libvir-list mailing list