Leaving it at -1 causes invalid free in virNetworkDefUpdateDNSHost if virNetworkDNSHostDefParseXML fails and virNetworkDNSHostDefClear gets called twice. --- src/conf/network_conf.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index d616e12..e3e0e89 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -136,6 +136,7 @@ virNetworkIpDefClear(virNetworkIpDefPtr def) while (def->nhosts--) virNetworkDHCPHostDefClear(&def->hosts[def->nhosts]); + def->nhosts = 0; VIR_FREE(def->hosts); VIR_FREE(def->tftproot); @@ -161,6 +162,7 @@ virNetworkDNSHostDefClear(virNetworkDNSHostDefPtr def) while (def->nnames--) VIR_FREE(def->names[def->nnames]); VIR_FREE(def->names); + def->nnames = 0; } static void @@ -190,6 +192,7 @@ virNetworkDNSDefClear(virNetworkDNSDefPtr def) virNetworkDNSSrvDefClear(&def->srvs[def->nsrvs]); VIR_FREE(def->srvs); } + def->ntxts = def->nhosts = def->nsrvs = 0; } static void @@ -206,6 +209,7 @@ virNetworkForwardDefClear(virNetworkForwardDefPtr def) virNetworkForwardIfDefClear(&def->ifs[i]); } VIR_FREE(def->ifs); + def->nifs = def->npfs = 0; } void -- 1.8.1.5 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list