From 09c6f09eb77a306f44490a9af0751e77cc9d1530 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 22 Feb 2025 10:02:20 -0800 Subject: [PATCH] xkb: ensure XkbAllocNames sets num_rg to 0 on allocation failure If there was a previous radio_groups array which we failed to realloc and freed instead, clear the array size in the XkbNamesRec. Taken from xorg/lib/libx11@258a8ced681dc1bc50396be7439fce23f9807e2a Signed-off-by: Alan Coopersmith Part-of: --- xkb/XKBAlloc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xkb/XKBAlloc.c b/xkb/XKBAlloc.c index 504687ce5..c8bf82d2f 100644 --- a/xkb/XKBAlloc.c +++ b/xkb/XKBAlloc.c @@ -192,8 +192,10 @@ XkbAllocNames(XkbDescPtr xkb, unsigned which, int nTotalRG, int nTotalAliases) free(prev_radio_groups); } } - if (names->radio_groups == NULL) + if (names->radio_groups == NULL) { + names->num_rg = 0; return BadAlloc; + } names->num_rg = nTotalRG; } return Success;