# SDL: kmsdrm: Avoid continuing if just the makecurrent failed

**URL:** <https://discourse.libsdl.org/t/sdl-kmsdrm-avoid-continuing-if-just-the-makecurrent-failed/69675>\
**Category:** SDL Commits\
**Created:** [October 28, 2026, 6:30pm UTC](https://discourse.libsdl.org/t/sdl-kmsdrm-avoid-continuing-if-just-the-makecurrent-failed/69675 "2026-10-28T18:30:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SDLPushPostBot](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sdlpushpostbot/32/4370_2.png) [@SDLPushPostBot](https://discourse.libsdl.org/u/SDLPushPostBot)\
**Post date:** [October 28, 2026, 6:30pm UTC](https://discourse.libsdl.org/t/sdl-kmsdrm-avoid-continuing-if-just-the-makecurrent-failed/69675/1 "2026-10-28T18:30:27Z")

</div>

> <https://github.com/libsdl-org/SDL/commit/13bc5da2a2cbdefcbc862f16b3799387c5b50eea>
>
> According to the source code comment we have another invocation later
> on. Withou…t this, the next loop iteration either overwrites windata-\>gs,
> causing a leak, or aborts and triggers the assert \`SDL\_assert(result || (windata-\>gs == NULL))\`

```diff
From 13bc5da2a2cbdefcbc862f16b3799387c5b50eea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dirk=20M=C3=BCller?= <[EMAIL REDACTED]>
Date: Mon, 5 Oct 2026 09:01:57 +0200
Subject: [PATCH] kmsdrm: Avoid continuing if just the makecurrent failed

According to the source code comment we have another invocation later
on. Without this, the next loop iteration either overwrites windata->gs,
causing a leak, or aborts and triggers the assert `SDL_assert(result || (windata->gs == NULL))`
---
 src/video/kmsdrm/SDL_kmsdrmvideo.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c
index 2dd451f9962f7..6099076331a7e 100644
--- a/src/video/kmsdrm/SDL_kmsdrmvideo.c
+++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c
@@ -1863,7 +1863,6 @@ bool KMSDRM_CreateSurfaces(SDL_VideoDevice *_this, SDL_Window *window)
         result = SDL_EGL_MakeCurrent(_this, windata->egl_surface, egl_context);
         if (!result) {
             SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "KMSDRM: SDL_EGL_MakeCurrent with GBM_FORMAT_%s failed: %s", gbm_formats[i].name, SDL_GetError());
- continue;
         }
 
         _this->gl_config.red_size = gbm_formats[i].r;

```
