summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Eyraud <70028899+meyraud705@users.noreply.github.com>2024-10-17 16:23:18 +0100
committerEmmanuele Bassi <ebassi@gnome.org>2024-10-23 18:16:55 +0100
commit7c122f4c9b9ba77e1b6b8cdf7453e11484c9243a (patch)
tree2a23b628c04c1f70090c49bca161d4b3ee6b3748
parent9b6b7a2545a063ef312fe7a261e80b92d4c0f55c (diff)
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. See: https://github.com/libsdl-org/SDL/pull/10521 Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
-rw-r--r--xsettings/xsettings-common.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/xsettings/xsettings-common.c b/xsettings/xsettings-common.c
index 3d74440..6f762d6 100644
--- a/xsettings/xsettings-common.c
+++ b/xsettings/xsettings-common.c
@@ -102,7 +102,10 @@ 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;