Since '337a13628' - Coverity complains that 'net' is VIR_ALLOC()'d,
but
on various 'cleanup' exit paths from the code there is no corresponding
cleanup. Since 'net' is eventually appended onto a list of nets we don't
want to delete the last one - be sure to set it to NULL, but still call
the free function in cleanup
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/xenconfig/xen_common.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c
index 398e9ec..c487feb 100644
--- a/src/xenconfig/xen_common.c
+++ b/src/xenconfig/xen_common.c
@@ -949,6 +949,7 @@ xenParseVif(virConfPtr conf, virDomainDefPtr def)
if (VIR_APPEND_ELEMENT(def->nets, def->nnets, net) < 0)
goto cleanup;
+ net = NULL;
skipnic:
list = list->next;
@@ -960,6 +961,7 @@ xenParseVif(virConfPtr conf, virDomainDefPtr def)
return 0;
cleanup:
+ virDomainNetDefFree(net);
VIR_FREE(script);
return -1;
}
--
1.9.3