On error, PERROR calls the already destroyed logger, which can segfault.
Re-order the calls, so the logger is still available.
Signed-off-by: Jason Andryuk <andryuk@aero.org>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
if (!xch)
return 0;
+ rc = xch->ops->close(xch, xch->ops_handle);
+ if (rc) PERROR("Could not close hypervisor interface");
+
xc__hypercall_buffer_cache_release(xch);
xtl_logger_destroy(xch->dombuild_logger_tofree);
xtl_logger_destroy(xch->error_handler_tofree);
- rc = xch->ops->close(xch, xch->ops_handle);
- if (rc) PERROR("Could not close hypervisor interface");
-
free(xch);
return rc;
}