summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeandro Nini <drfiemost@email.it>2022-12-10 07:49:56 +0000
committerLeandro Nini <drfiemost@email.it>2022-12-10 09:35:43 +0100
commit931c469b2b91603c5c196abf65a39c7dab8609d7 (patch)
tree2a16653ceba35bccb2dddaa6dc479e3b94cf44aa
parent7bac6a25bb44d39710f1b2b5fdad56d7f4c01c39 (diff)
Avoid possibly dereferencing null pointer
This addresses issue #21 Signed-off-by: Leandro Nini <drfiemost@email.it>
-rw-r--r--geometry.c13
1 files 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);