From e5bb4fa90fefa873671eb3456c4efb2075b202de Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sun, 28 Jul 2024 07:51:31 -0700
Subject: [PATCH] Fixed memory leak in testthread
(cherry picked from commit dfe6efcd2df1b7781ce9bbcf86963bafda589b5e)
(cherry picked from commit 224a37faabe3a074b7f0b1fd17848526961ca0a0)
---
test/testthread.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/test/testthread.c b/test/testthread.c
index b57dfde1856c2..188bc715f1913 100644
--- a/test/testthread.c
+++ b/test/testthread.c
@@ -19,6 +19,7 @@
#include "SDL.h"
static SDL_TLSID tls;
+static SDL_Thread *thread = NULL;
static SDL_atomic_t alive;
static int testprio = 0;
@@ -77,13 +78,13 @@ killed(int sig)
SDL_Log("Killed with SIGTERM, waiting 5 seconds to exit\n");
SDL_Delay(5 * 1000);
SDL_AtomicSet(&alive, 0);
+ SDL_WaitThread(thread, NULL);
quit(0);
}
int main(int argc, char *argv[])
{
int arg = 1;
- SDL_Thread *thread;
/* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);