aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/xkb
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/xkb')
-rw-r--r--xorg-server/xkb/XKBGAlloc.c18
-rw-r--r--xorg-server/xkb/XKBMAlloc.c18
-rw-r--r--xorg-server/xkb/ddxList.c5
-rw-r--r--xorg-server/xkb/ddxLoad.c9
-rw-r--r--xorg-server/xkb/xkb.c21
-rw-r--r--xorg-server/xkb/xkbInit.c6
-rw-r--r--xorg-server/xkb/xkbUtils.c16
7 files changed, 45 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 b148c714f..e4e32075b 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)
{
diff --git a/xorg-server/xkb/ddxLoad.c b/xorg-server/xkb/ddxLoad.c
index 6cf8e7ee9..b8fd71776 100644
--- a/xorg-server/xkb/ddxLoad.c
+++ b/xorg-server/xkb/ddxLoad.c
@@ -74,6 +74,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifdef WIN32
+#define strdup _strdup
+
#include <X11/Xwindows.h>
const char*
Win32TempDir()
@@ -103,7 +105,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 +237,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 cd48515d7..b491f8240 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));
@@ -5888,11 +5886,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 eb3e04d64..98483857c 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..63c99e51b 100644
--- a/xorg-server/xkb/xkbUtils.c
+++ b/xorg-server/xkb/xkbUtils.c
@@ -69,6 +69,10 @@ DEALINGS IN THE SOFTWARE.
#include "xkbgeom.h"
#include "xkb.h"
+#ifdef _MSC_VER
+#define strdup _strdup
+#endif
+
/***====================================================================***/
int
@@ -1761,15 +1765,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 +1836,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);
}
}