From 931c469b2b91603c5c196abf65a39c7dab8609d7 Mon Sep 17 00:00:00 2001 From: Leandro Nini Date: Sat, 10 Dec 2022 07:49:56 +0000 Subject: Avoid possibly dereferencing null pointer This addresses issue #21 Signed-off-by: Leandro Nini --- geometry.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/geometry.c b/geometry.c index a759616..91ab244 100644 --- a/geometry.c +++ b/geometry.c @@ -2569,12 +2569,15 @@ HandleOverlayDef(OverlayDef * def, keyDef = (OverlayKeyDef *) keyDef->common.next) { key = uTypedCalloc(1, OverlayKeyInfo); - if ((!key) && warningLevel > 0) + if (!key) { - WSGO("Couldn't allocate OverlayKeyInfo\n"); - ACTION("Overlay %s for section %s will be incomplete\n", - XkbAtomText(info->dpy, ol.name, XkbMessage), - scText(info->dpy, si)); + if (warningLevel > 0) + { + WSGO("Couldn't allocate OverlayKeyInfo\n"); + ACTION("Overlay %s for section %s will be incomplete\n", + XkbAtomText(info->dpy, ol.name, XkbMessage), + scText(info->dpy, si)); + } return False; } strncpy(key->over, keyDef->over, XkbKeyNameLength); -- cgit v1.2.3