From 6bd204e2abf18bb00fa0f21c16ebd151e8e4976c Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 17 Apr 2026 15:10:41 +1000 Subject: [PATCH] xkb: fail if we can't strdup our default rules If we fail to set up the default rules our keymap is likely going to end up messed up, which means the client/user can't work correctly anyway. And if we're that low on memory that we can't allocate these rules, we're about to fall over anyway so why bother. Co-Authored-by: Claude Code Part-of: --- xkb/xkbInit.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c index f07838071..bfdc90556 100644 --- a/xkb/xkbInit.c +++ b/xkb/xkbInit.c @@ -107,11 +107,11 @@ static Bool XkbWantRulesProp = XKB_DFLT_RULES_PROP; void XkbGetRulesDflts(XkbRMLVOSet * rmlvo) { - rmlvo->rules = strdup(XkbRulesDflt ? XkbRulesDflt : XKB_DFLT_RULES); - rmlvo->model = strdup(XkbModelDflt ? XkbModelDflt : XKB_DFLT_MODEL); - rmlvo->layout = strdup(XkbLayoutDflt ? XkbLayoutDflt : XKB_DFLT_LAYOUT); - rmlvo->variant = strdup(XkbVariantDflt ? XkbVariantDflt : XKB_DFLT_VARIANT); - rmlvo->options = strdup(XkbOptionsDflt ? XkbOptionsDflt : XKB_DFLT_OPTIONS); + rmlvo->rules = XNFstrdup(XkbRulesDflt ? XkbRulesDflt : XKB_DFLT_RULES); + rmlvo->model = XNFstrdup(XkbModelDflt ? XkbModelDflt : XKB_DFLT_MODEL); + rmlvo->layout = XNFstrdup(XkbLayoutDflt ? XkbLayoutDflt : XKB_DFLT_LAYOUT); + rmlvo->variant = XNFstrdup(XkbVariantDflt ? XkbVariantDflt : XKB_DFLT_VARIANT); + rmlvo->options = XNFstrdup(XkbOptionsDflt ? XkbOptionsDflt : XKB_DFLT_OPTIONS); } void