[PATCH libxkbfile 03/12] libxkbfle: Move xkb->map NULL check before first dereference

Pauli Nieminen ext-pauli.nieminen at nokia.com
Wed Jul 21 05:02:47 PDT 2010


Signed-off-by: Pauli Nieminen <ext-pauli.nieminen at nokia.com>
---
 src/xkmout.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/xkmout.c b/src/xkmout.c
index 1c0a0a4..4f25e5d 100644
--- a/src/xkmout.c
+++ b/src/xkmout.c
@@ -541,6 +541,10 @@ unsigned		tmp,size= 0;
 
     xkb= result->xkb;
     dpy= xkb->dpy;
+    if (!xkb->map) {
+	_XkbLibError(_XkbErrMissingSymbols,"WriteXKMSymbols",0);
+	return 0;
+    }
     if (xkb->names && (xkb->names->symbols!=None))
 	 name= XkbAtomGetString(dpy,xkb->names->symbols);
     else name= NULL;
@@ -562,7 +566,7 @@ unsigned		tmp,size= 0;
 	char *typeName[XkbNumKbdGroups];
 	wireMap.width= XkbKeyGroupsWidth(xkb,i);
 	wireMap.num_groups= XkbKeyGroupInfo(xkb,i);
-	if (xkb->map && xkb->map->modmap)
+	if (xkb->map->modmap)
 	     wireMap.modifier_map= xkb->map->modmap[i];
 	else wireMap.modifier_map= 0;
 	wireMap.flags= 0;
-- 
1.6.3.3



More information about the xorg-devel mailing list