The virBhyveProcessStartImpl() function which implements domain start
does not check if bhyve monitor open is successful. Check that and
jump to the cleanup routines if it was not.

Signed-off-by: Roman Bogorodskiy <[email protected]>
---
 src/bhyve/bhyve_process.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c
index 2221d8700a..4d93ba8fac 100644
--- a/src/bhyve/bhyve_process.c
+++ b/src/bhyve/bhyve_process.c
@@ -411,7 +411,8 @@ virBhyveProcessStartImpl(struct _bhyveConn *driver,
 
     vm->def->id = vm->pid;
     virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, reason);
-    priv->mon = bhyveMonitorOpen(vm, driver);
+    if ((priv->mon = bhyveMonitorOpen(vm, driver)) == NULL)
+        goto cleanup;
 
     if (virBhyveDomainObjStartWorker(vm) < 0)
         goto cleanup;
-- 
2.52.0

Reply via email to