SDL: Fix xsettings list copy

From 45bfa8e5e730b04deb263a82ed4eb8be8f3f0a1d Mon Sep 17 00:00:00 2001
From: Mathieu Eyraud <[EMAIL REDACTED]>
Date: Sun, 11 Aug 2024 12:27:33 +0200
Subject: [PATCH] Fix xsettings list copy

If there is only 1 element in the list or memory allocation fails on the 2nd iteration then new->next is uninitialised.
---
 src/video/x11/xsettings-client.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/video/x11/xsettings-client.c b/src/video/x11/xsettings-client.c
index 7d413ab64f6a2..8fb1cd3c6c821 100644
--- a/src/video/x11/xsettings-client.c
+++ b/src/video/x11/xsettings-client.c
@@ -691,7 +691,11 @@ xsettings_list_copy (XSettingsList *list)
       if (new_iter)
         new_iter->next = new_node;
       else
-        new = new_node;
+        {
+          new = new_node;
+          new->next = NULL;
+        }
+
 
       new_iter = new_node;