From a39427be495acaf0f569d5d308df8147b2d583b7 Mon Sep 17 00:00:00 2001 From: John Ferlan Date: Tue, 27 Mar 2018 10:18:06 -0400 Subject: [PATCH] uml: Fix umlProcessAutoDestroyDom dom processing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There's no need to check if @dom exists before trying to call virDomainObjListRemove since it must exist due to prior checks. Additionally, if we do remove the @dom, then set it to NULL so that the virObjectUnlock isn't referencing something that is deleted. Signed-off-by: John Ferlan Reviewed-by: Marc Hartmayer Reviewed-by: Daniel P. Berrangé --- src/uml/uml_driver.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c index 56dfd7b581..23d09891f4 100644 --- a/src/uml/uml_driver.c +++ b/src/uml/uml_driver.c @@ -747,8 +747,10 @@ static int umlProcessAutoDestroyDom(void *payload, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_DESTROYED); - if (dom && !dom->persistent) + if (!dom->persistent) { virDomainObjListRemove(data->driver->domains, dom); + dom = NULL; + } if (dom) virObjectUnlock(dom);