Fix crash on OpenXR error before context is created fully
authorJulian Eisel <eiseljulian@gmail.com>
Fri, 12 Jul 2019 23:19:58 +0000 (01:19 +0200)
committerJulian Eisel <eiseljulian@gmail.com>
Fri, 12 Jul 2019 23:19:58 +0000 (01:19 +0200)
intern/ghost/intern/GHOST_Xr.cpp

index 0028a2c65ec7a5ab0ea259a1f6d87f0d309b6aa0..3d89e860dae4fd33bc6e3dbb1b0fed297ac6e7d0 100644 (file)
@@ -45,6 +45,9 @@ GHOST_XrContextHandle GHOST_XrContextCreate(const GHOST_XrContextCreateInfo *cre
   }
   catch (GHOST_XrException &e) {
     xr_context->dispatchErrorMessage(&e);
+    delete xr_context;
+
+    return nullptr;
   }
 
   return (GHOST_XrContextHandle)xr_context;