mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-01 12:46:12 +00:00
st/oxr: Fix possible null dereference.
Found by clang-tidy.
This commit is contained in:
parent
c8776a8b0d
commit
0088c6cb6e
|
@ -607,17 +607,19 @@ oxr_session_create(struct oxr_logger *log,
|
||||||
const XrSessionCreateInfo *createInfo,
|
const XrSessionCreateInfo *createInfo,
|
||||||
struct oxr_session **out_session)
|
struct oxr_session **out_session)
|
||||||
{
|
{
|
||||||
struct oxr_session *sess;
|
struct oxr_session *sess = NULL;
|
||||||
|
|
||||||
/* Try allocating and populating. */
|
/* Try allocating and populating. */
|
||||||
XrResult ret = oxr_session_create_impl(log, sys, createInfo, &sess);
|
XrResult ret = oxr_session_create_impl(log, sys, createInfo, &sess);
|
||||||
|
|
||||||
if (ret != XR_SUCCESS) {
|
if (ret != XR_SUCCESS) {
|
||||||
/* clean up allocation first */
|
if (sess != NULL) {
|
||||||
XrResult cleanup_result =
|
/* clean up allocation first */
|
||||||
oxr_handle_destroy(log, &sess->handle);
|
XrResult cleanup_result =
|
||||||
assert(cleanup_result == XR_SUCCESS);
|
oxr_handle_destroy(log, &sess->handle);
|
||||||
(void)cleanup_result;
|
assert(cleanup_result == XR_SUCCESS);
|
||||||
|
(void)cleanup_result;
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue