Ver Fonte

Fixed memory leak in testffmpeg EGL codepath

Fixes https://github.com/libsdl-org/SDL/issues/14908

(cherry picked from commit ee38b7c3dfc4f534195cf9a6f6e5227368e1b4e3)
Sam Lantinga há 1 mês atrás
pai
commit
9c0b773f09
1 ficheiros alterados com 2 adições e 0 exclusões
  1. 2 0
      test/testffmpeg.c

+ 2 - 0
test/testffmpeg.c

@@ -737,6 +737,7 @@ static bool GetNV12TextureForDRMFrame(AVFrame *frame, SDL_Texture **texture)
             glActiveTextureARBFunc(GL_TEXTURE0_ARB + image_index);
             glActiveTextureARBFunc(GL_TEXTURE0_ARB + image_index);
             glBindTexture(GL_TEXTURE_2D, textures[image_index]);
             glBindTexture(GL_TEXTURE_2D, textures[image_index]);
             glEGLImageTargetTexture2DOESFunc(GL_TEXTURE_2D, image);
             glEGLImageTargetTexture2DOESFunc(GL_TEXTURE_2D, image);
+            eglDestroyImage(display, image);
             ++image_index;
             ++image_index;
         }
         }
     }
     }
@@ -922,6 +923,7 @@ static bool GetOESTextureForDRMFrame(AVFrame *frame, SDL_Texture **texture)
     glActiveTextureARBFunc(GL_TEXTURE0_ARB);
     glActiveTextureARBFunc(GL_TEXTURE0_ARB);
     glBindTexture(GL_TEXTURE_EXTERNAL_OES, textureID);
     glBindTexture(GL_TEXTURE_EXTERNAL_OES, textureID);
     glEGLImageTargetTexture2DOESFunc(GL_TEXTURE_EXTERNAL_OES, image);
     glEGLImageTargetTexture2DOESFunc(GL_TEXTURE_EXTERNAL_OES, image);
+    eglDestroyImage(display, image);
     return true;
     return true;
 }
 }
 #endif /* HAVE_EGL */
 #endif /* HAVE_EGL */