summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorwalter harms <wharms@bfs.de>2014-06-04 17:10:20 +0200
committerAlan Coopersmith <alan.coopersmith@oracle.com>2014-06-06 17:05:58 -0700
commita3808f51517a720e7ff738208af60865779dd6ef (patch)
treeb3a1e98a82266cc87ec367207b8c3a7e4f64cd87 /src
parentb3c9f6a17e430aabe16aecbe097f7312a0f6ff78 (diff)
libX11/XKBNames.c fix: dereferenced before check
* Do not use variables before checked for NULL. Signed-off-by: Harms <wharms@bfs,de> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'src')
-rw-r--r--src/xkb/XKBNames.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/xkb/XKBNames.c b/src/xkb/XKBNames.c
index 3f2fd39d..5a3fb6f8 100644
--- a/src/xkb/XKBNames.c
+++ b/src/xkb/XKBNames.c
@@ -778,9 +778,14 @@ XkbNoteNameChanges(XkbNameChangesPtr old,
{
int first, last, old_last, new_last;
- wanted &= new->changed;
- if ((old == NULL) || (new == NULL) || (wanted == 0))
+ if ((old == NULL) || (new == NULL))
return;
+
+ wanted &= new->changed;
+
+ if (wanted == 0)
+ return;
+
if (wanted & XkbKeyTypeNamesMask) {
if (old->changed & XkbKeyTypeNamesMask) {
new_last = (new->first_type + new->num_types - 1);