st/oxr: Fix possible null dereference.

Found by clang-tidy.
This commit is contained in:
Ryan Pavlik 2019-08-16 17:02:38 -05:00
parent c8776a8b0d
commit 0088c6cb6e

View file

@ -607,17 +607,19 @@ oxr_session_create(struct oxr_logger *log,
const XrSessionCreateInfo *createInfo,
struct oxr_session **out_session)
{
struct oxr_session *sess;
struct oxr_session *sess = NULL;
/* Try allocating and populating. */
XrResult ret = oxr_session_create_impl(log, sys, createInfo, &sess);
if (ret != XR_SUCCESS) {
/* clean up allocation first */
XrResult cleanup_result =
oxr_handle_destroy(log, &sess->handle);
assert(cleanup_result == XR_SUCCESS);
(void)cleanup_result;
if (sess != NULL) {
/* clean up allocation first */
XrResult cleanup_result =
oxr_handle_destroy(log, &sess->handle);
assert(cleanup_result == XR_SUCCESS);
(void)cleanup_result;
}
return ret;
}