SDL: Fix memory leak in WIN_GetMonitorPathInfo

From 29d43272e2dd2c61b329bc7af3c6b04691d34071 Mon Sep 17 00:00:00 2001
From: Mathieu Eyraud <[EMAIL REDACTED]>
Date: Fri, 5 Apr 2024 19:10:52 +0200
Subject: [PATCH] Fix memory leak in WIN_GetMonitorPathInfo

---
 src/video/windows/SDL_windowsmodes.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/video/windows/SDL_windowsmodes.c b/src/video/windows/SDL_windowsmodes.c
index 7ea27ca7475e7..e9371fc441ff4 100644
--- a/src/video/windows/SDL_windowsmodes.c
+++ b/src/video/windows/SDL_windowsmodes.c
@@ -407,6 +407,8 @@ static SDL_bool WIN_GetMonitorPathInfo(HMONITOR hMonitor, DISPLAYCONFIG_PATH_INF
 
     do {
         if (GetDisplayConfigBufferSizes(QDC_ONLY_ACTIVE_PATHS, &num_path_array_elements, &num_mode_info_array_elements) != ERROR_SUCCESS) {
+            SDL_free(path_infos);
+            SDL_free(mode_infos);
             return SDL_FALSE;
         }