From 4776a74bf7f1ed60efee22290c5fea732d7e2e5a Mon Sep 17 00:00:00 2001 From: Edward Date: Fri, 21 Oct 2022 15:35:20 +0200 Subject: Fix T101974: Potential memoryleak GHOST_WindowWayland.newDrawingContext Reviewed By: jbakker Maniphest Tasks: T101974 Differential Revision: https://developer.blender.org/D16309 --- intern/ghost/intern/GHOST_WindowWayland.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/intern/ghost/intern/GHOST_WindowWayland.cpp b/intern/ghost/intern/GHOST_WindowWayland.cpp index b29c5efd8d4..986e18d7a87 100644 --- a/intern/ghost/intern/GHOST_WindowWayland.cpp +++ b/intern/ghost/intern/GHOST_WindowWayland.cpp @@ -946,7 +946,12 @@ GHOST_Context *GHOST_WindowWayland::newDrawingContext(GHOST_TDrawingContextType EGL_OPENGL_API); } - return (context->initializeDrawingContext() == GHOST_kSuccess) ? context : nullptr; + if (context->initializeDrawingContext()) { + return context; + } + + delete context; + return nullptr; } /** \} */ -- cgit v1.2.3