SDL: Fixed memory leak in testffmpeg EGL codepath

From ee38b7c3dfc4f534195cf9a6f6e5227368e1b4e3 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 28 Jan 2026 08:20:44 -0800
Subject: [PATCH] Fixed memory leak in testffmpeg EGL codepath

Fixes https://github.com/libsdl-org/SDL/issues/14908
---
 test/testffmpeg.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/test/testffmpeg.c b/test/testffmpeg.c
index d0e1cc89ab9c6..a68fc09916026 100644
--- a/test/testffmpeg.c
+++ b/test/testffmpeg.c
@@ -737,6 +737,7 @@ static bool GetNV12TextureForDRMFrame(AVFrame *frame, SDL_Texture **texture)
             glActiveTextureARBFunc(GL_TEXTURE0_ARB + image_index);
             glBindTexture(GL_TEXTURE_2D, textures[image_index]);
             glEGLImageTargetTexture2DOESFunc(GL_TEXTURE_2D, image);
+            eglDestroyImage(display, image);
             ++image_index;
         }
     }
@@ -922,6 +923,7 @@ static bool GetOESTextureForDRMFrame(AVFrame *frame, SDL_Texture **texture)
     glActiveTextureARBFunc(GL_TEXTURE0_ARB);
     glBindTexture(GL_TEXTURE_EXTERNAL_OES, textureID);
     glEGLImageTargetTexture2DOESFunc(GL_TEXTURE_EXTERNAL_OES, image);
+    eglDestroyImage(display, image);
     return true;
 }
 #endif /* HAVE_EGL */