diff options
Diffstat (limited to 'xorg-server/xkb')
-rw-r--r-- | xorg-server/xkb/XKBGAlloc.c | 18 | ||||
-rw-r--r-- | xorg-server/xkb/XKBMAlloc.c | 18 | ||||
-rw-r--r-- | xorg-server/xkb/ddxList.c | 5 | ||||
-rw-r--r-- | xorg-server/xkb/ddxLoad.c | 7 | ||||
-rw-r--r-- | xorg-server/xkb/xkb.c | 21 | ||||
-rw-r--r-- | xorg-server/xkb/xkbInit.c | 6 | ||||
-rw-r--r-- | xorg-server/xkb/xkbUtils.c | 12 |
7 files changed, 39 insertions, 48 deletions
diff --git a/xorg-server/xkb/XKBGAlloc.c b/xorg-server/xkb/XKBGAlloc.c index b5c9b8446..a6d10c4b0 100644 --- a/xorg-server/xkb/XKBGAlloc.c +++ b/xorg-server/xkb/XKBGAlloc.c @@ -114,10 +114,8 @@ register char *ptr; }
if (freeAll) {
(*num_inout)= (*sz_inout)= 0;
- if (*elems) {
- free(*elems);
- *elems= NULL;
- }
+ free(*elems);
+ *elems = NULL;
}
else if (first+count>=(*num_inout))
*num_inout= first;
@@ -137,14 +135,10 @@ _XkbClearProperty(char *prop_in) {
XkbPropertyPtr prop= (XkbPropertyPtr)prop_in;
- if (prop->name) {
- free(prop->name);
- prop->name= NULL;
- }
- if (prop->value) {
- free(prop->value);
- prop->value= NULL;
- }
+ free(prop->name);
+ prop->name = NULL;
+ free(prop->value);
+ prop->value = NULL;
return;
}
diff --git a/xorg-server/xkb/XKBMAlloc.c b/xorg-server/xkb/XKBMAlloc.c index 0bd7b5e01..28995de81 100644 --- a/xorg-server/xkb/XKBMAlloc.c +++ b/xorg-server/xkb/XKBMAlloc.c @@ -221,18 +221,12 @@ XkbCopyKeyType(XkbKeyTypePtr from,XkbKeyTypePtr into) {
if ((!from)||(!into))
return BadMatch;
- if (into->map) {
- free(into->map);
- into->map= NULL;
- }
- if (into->preserve) {
- free(into->preserve);
- into->preserve= NULL;
- }
- if (into->level_names) {
- free(into->level_names);
- into->level_names= NULL;
- }
+ free(into->map);
+ into->map = NULL;
+ free(into->preserve);
+ into->preserve = NULL;
+ free(into->level_names);
+ into->level_names = NULL;
*into= *from;
if ((from->map)&&(into->map_count>0)) {
into->map= calloc(into->map_count, sizeof(XkbKTMapEntryRec));
diff --git a/xorg-server/xkb/ddxList.c b/xorg-server/xkb/ddxList.c index 927b885fb..ce3445bda 100644 --- a/xorg-server/xkb/ddxList.c +++ b/xorg-server/xkb/ddxList.c @@ -208,10 +208,7 @@ char tmpname[PATH_MAX]; return BadImplementation;
}
list->nFound[what]= 0;
- if (buf) {
- free(buf);
- buf = NULL;
- }
+ free(buf);
buf = malloc(PATH_MAX * sizeof(char));
if (!buf)
return BadAlloc;
diff --git a/xorg-server/xkb/ddxLoad.c b/xorg-server/xkb/ddxLoad.c index 32125015f..6742537e7 100644 --- a/xorg-server/xkb/ddxLoad.c +++ b/xorg-server/xkb/ddxLoad.c @@ -103,7 +103,7 @@ Win32System(const char *cmdline) STARTUPINFO si;
PROCESS_INFORMATION pi;
DWORD dwExitCode;
- char *cmd = xstrdup(cmdline);
+ char *cmd = strdup(cmdline);
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
@@ -235,6 +235,11 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb, xkm_output_dir, keymap);
free(xkbbasedirflag);
+
+ if (!buf) {
+ LogMessage(X_ERROR, "XKB: Could not invoke xkbcomp: not enough memory\n");
+ return FALSE;
+ }
#ifndef WIN32
out= Popen(buf,"w");
diff --git a/xorg-server/xkb/xkb.c b/xorg-server/xkb/xkb.c index bb57b1653..f1cae4945 100644 --- a/xorg-server/xkb/xkb.c +++ b/xorg-server/xkb/xkb.c @@ -5510,10 +5510,8 @@ ProcXkbListComponents(ClientPtr client) if ((XkbPaddedSize(len)/4)!=stuff->length)
return BadLength;
if ((status=XkbDDXList(dev,&list,client))!=Success) {
- if (list.pool) {
- free(list.pool);
- list.pool= NULL;
- }
+ free(list.pool);
+ list.pool = NULL;
return status;
}
memset(&rep, 0, sizeof(xkbListComponentsReply));
@@ -5886,11 +5884,16 @@ ProcXkbGetKbdByName(ClientPtr client) XkbFreeKeyboard(new,XkbAllComponentsMask,TRUE);
new= NULL;
}
- if (names.keycodes) { free(names.keycodes); names.keycodes= NULL; }
- if (names.types) { free(names.types); names.types= NULL; }
- if (names.compat) { free(names.compat); names.compat= NULL; }
- if (names.symbols) { free(names.symbols); names.symbols= NULL; }
- if (names.geometry) { free(names.geometry); names.geometry= NULL; }
+ free(names.keycodes);
+ names.keycodes = NULL;
+ free(names.types);
+ names.types = NULL;
+ free(names.compat);
+ names.compat = NULL;
+ free(names.symbols);
+ names.symbols = NULL;
+ free(names.geometry);
+ names.geometry = NULL;
return Success;
}
diff --git a/xorg-server/xkb/xkbInit.c b/xorg-server/xkb/xkbInit.c index e06f48c9e..6defefa50 100644 --- a/xorg-server/xkb/xkbInit.c +++ b/xorg-server/xkb/xkbInit.c @@ -635,10 +635,8 @@ unwind_key: void
XkbFreeInfo(XkbSrvInfoPtr xkbi)
{
- if (xkbi->radioGroups) {
- free(xkbi->radioGroups);
- xkbi->radioGroups= NULL;
- }
+ free(xkbi->radioGroups);
+ xkbi->radioGroups = NULL;
if (xkbi->mouseKeyTimer) {
TimerFree(xkbi->mouseKeyTimer);
xkbi->mouseKeyTimer= NULL;
diff --git a/xorg-server/xkb/xkbUtils.c b/xorg-server/xkb/xkbUtils.c index 6b6e6d379..b0e643e62 100644 --- a/xorg-server/xkb/xkbUtils.c +++ b/xorg-server/xkb/xkbUtils.c @@ -1761,15 +1761,15 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) if (sdoodad->any.type == XkbTextDoodad) {
if (sdoodad->text.text)
ddoodad->text.text =
- xstrdup(sdoodad->text.text);
+ strdup(sdoodad->text.text);
if (sdoodad->text.font)
ddoodad->text.font =
- xstrdup(sdoodad->text.font);
+ strdup(sdoodad->text.font);
}
else if (sdoodad->any.type == XkbLogoDoodad) {
if (sdoodad->logo.logo_name)
ddoodad->logo.logo_name =
- xstrdup(sdoodad->logo.logo_name);
+ strdup(sdoodad->logo.logo_name);
}
}
dsection->overlays = NULL;
@@ -1832,14 +1832,14 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) memcpy(ddoodad , sdoodad, sizeof(XkbDoodadRec));
if (sdoodad->any.type == XkbTextDoodad) {
if (sdoodad->text.text)
- ddoodad->text.text = xstrdup(sdoodad->text.text);
+ ddoodad->text.text = strdup(sdoodad->text.text);
if (sdoodad->text.font)
- ddoodad->text.font = xstrdup(sdoodad->text.font);
+ ddoodad->text.font = strdup(sdoodad->text.font);
}
else if (sdoodad->any.type == XkbLogoDoodad) {
if (sdoodad->logo.logo_name)
ddoodad->logo.logo_name =
- xstrdup(sdoodad->logo.logo_name);
+ strdup(sdoodad->logo.logo_name);
}
}
|