From: John Ferlan Date: Mon, 16 Dec 2019 12:36:32 +0000 (-0500) Subject: vbox: Reset @ret after xmlFreeNode X-Git-Tag: v6.0.0-rc1~184 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=93b8c6b1195ce0b003f1e36d61c5e7508fbd79e1;p=thirdparty%2Flibvirt.git vbox: Reset @ret after xmlFreeNode 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 Reviewed-by: Michal Privoznik --- 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;