parallels: fix libvirt crash if parallelsNetworkOpen fails

If, by any reason, parallelsNetworkOpen fails it dereferences
newly allocated privconn->networks via virObjectUnref, which in
turn deallocates its memory.
Subsequent call of parallelsNetworkClose calls virObjectUnref
that leads to double memory free. To prevent this we should zero
privconn->networks to make all subsequent virObjectUnref be safe.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
This commit is contained in:
Maxim Nestratov 2015-03-19 17:43:21 +03:00 committed by Michal Privoznik
parent 4f06820938
commit a4da09d20a

View File

@ -348,6 +348,7 @@ parallelsNetworkOpen(virConnectPtr conn,
return VIR_DRV_OPEN_SUCCESS;
error:
virObjectUnref(privconn->networks);
privconn->networks = NULL;
return VIR_DRV_OPEN_DECLINED;
}