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>
This commit is contained in:
walter harms 2014-06-04 17:10:20 +02:00 committed by Alan Coopersmith
parent b3c9f6a17e
commit a3808f5151

View file

@ -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);