Commit 50ebe95a authored by Alan Coopersmith's avatar Alan Coopersmith

Remove useless checks for NULL before free in OverlayKeyCreate()

There is no need to ensure the pointers passed to free are not NULL,
especially right after passing them to strncpy without checking for

Flagged by cppcheck 1.64:
[app/xkbcomp/parseutils.c:557] -> [app/xkbcomp/parseutils.c:559]:
 (warning) Possible null pointer dereference: over - otherwise it
           is redundant to check it against null.
[app/xkbcomp/parseutils.c:558] -> [app/xkbcomp/parseutils.c:561]:
 (warning) Possible null pointer dereference: under - otherwise it
           is redundant to check it against null.
Signed-off-by: Alan Coopersmith's avatarAlan Coopersmith <>
Reviewed-by: Peter Hutterer's avatarPeter Hutterer <>
Reviewed-by: Daniel Stone's avatarDaniel Stone <>
parent 31b90ee4
......@@ -556,10 +556,8 @@ OverlayKeyCreate(char *under, char *over)
key->common.stmtType = StmtOverlayKeyDef;
strncpy(key->over, over, XkbKeyNameLength);
strncpy(key->under, under, XkbKeyNameLength);
if (over)
if (under)
return key;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment