[PATCH] parallels: fix libvirt crash if parallelsNetworkClose fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If, by any reason, parallelsNetworkClose 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@xxxxxxxxxxxxx>
---
 src/parallels/parallels_network.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/parallels/parallels_network.c b/src/parallels/parallels_network.c
index 8cc0582..8caad4a 100644
--- a/src/parallels/parallels_network.c
+++ b/src/parallels/parallels_network.c
@@ -348,6 +348,7 @@ parallelsNetworkOpen(virConnectPtr conn,
     return VIR_DRV_OPEN_SUCCESS;
  error:
     virObjectUnref(privconn->networks);
+    privconn->networks = NULL;
     return VIR_DRV_OPEN_DECLINED;
 }
 
-- 
1.7.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]