Coverity found out that commit cd490086 caused a possible NULL pointer
dereference. This is due to the fact, that phyp_driver might be
NULL (if VIR_ALLOC() fails), but connection_data, which kept the socket
before the mentioned commit, could not be NULL.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/phyp/phyp_driver.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 7c8bc5c..0d3ad53 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -1222,6 +1222,7 @@ phypConnectOpen(virConnectPtr conn,
if (phyp_driver != NULL) {
virObjectUnref(phyp_driver->caps);
virObjectUnref(phyp_driver->xmlopt);
+ VIR_FORCE_CLOSE(phyp_driver->sock);
VIR_FREE(phyp_driver);
}
@@ -1232,8 +1233,6 @@ phypConnectOpen(virConnectPtr conn,
libssh2_session_free(session);
}
- VIR_FORCE_CLOSE(phyp_driver->sock);
-
return VIR_DRV_OPEN_ERROR;
}
--
2.1.3