aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent/Rootless.c
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/Rootless.c')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Rootless.c49
1 files changed, 41 insertions, 8 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c
index 68c6890d8..f42f9d99d 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c
@@ -315,6 +315,13 @@ void nxagentRootlessRestack(unsigned long children[], unsigned int nchildren)
Mask mask;
toplevel = malloc(sizeof(WindowPtr) * nchildren);
+
+ if (!toplevel)
+ {
+ /* FIXME: Is this too much and we and simply return here? */
+ FatalError("nxagentRootlessRestack: malloc() failed.");
+ }
+
ntoplevel = 0;
for(i = 0; i < nchildren; i++)
@@ -334,6 +341,7 @@ void nxagentRootlessRestack(unsigned long children[], unsigned int nchildren)
if (!ntoplevel)
{
+ free(toplevel);
return;
}
@@ -343,14 +351,14 @@ void nxagentRootlessRestack(unsigned long children[], unsigned int nchildren)
for (i = 0; i < ntoplevel; i++)
{
- fprintf(stderr, "[%p]\n", toplevel[i]);
+ fprintf(stderr, "nxagentRootlessRestack: [%p]\n", toplevel[i]);
}
fprintf(stderr, "nxagentRootlessRestack: Internal top level windows before restack:");
for (pWin = screenInfo.screens[0]->root -> firstChild; pWin != NULL; pWin = pWin -> nextSib)
{
- fprintf(stderr, "[%p]\n", pWin);
+ fprintf(stderr, "nxagentRootlessRestack: [%p]\n", pWin);
}
#endif
@@ -386,14 +394,14 @@ void nxagentRootlessRestack(unsigned long children[], unsigned int nchildren)
for (i = 0; i < ntoplevel; i++)
{
- fprintf(stderr, "[%p]\n", toplevel[i]);
+ fprintf(stderr, "nxagentRootlessRestack: [%p]\n", toplevel[i]);
}
fprintf(stderr, "nxagentRootlessRestack: Internal top level windows after restack:");
for (pWin = screenInfo.screens[0]->root -> firstChild; pWin != NULL; pWin = pWin -> nextSib)
{
- fprintf(stderr, "[%p]\n", pWin);
+ fprintf(stderr, "nxagentRootlessRestack: [%p]\n", pWin);
}
#endif
@@ -496,6 +504,7 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
#ifdef _XSERVER64
else if (strcmp(typeS, "CARDINAL") == 0 || strcmp(typeS, "WM_SIZE_HINTS") == 0)
{
+ /* FIXME: is it okay here to ignore malloc fails? */
unsigned long *buffer = malloc(nUnits * sizeof(*buffer));
int *input = value;
int i;
@@ -639,6 +648,14 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
int i;
int j = 0;
+ if (!atoms)
+ {
+ #ifdef WARNING
+ fprintf(stderr, "nxagentExportProperty: WARNING! malloc() failed for '%s'- bailing out.\n", typeS);
+ #endif
+ return False;
+ }
+
freeMem = True;
export = True;
output = (char *) atoms;
@@ -689,6 +706,14 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
WindowPtr pWindow;
int i;
+ if (!wind)
+ {
+ #ifdef WARNING
+ fprintf(stderr, "nxagentExportProperty: WARNING! malloc() failed for '%s' - bailing out.\n", typeS);
+ #endif
+ return False;
+ }
+
freeMem = True;
export = True;
output = (char*) wind;
@@ -965,7 +990,7 @@ void nxagentImportProperty(Window window,
}
}
- if ((wmHints.flags & IconWindowHint) && (wmHints.icon_window =! None))
+ if ((wmHints.flags & IconWindowHint) && (wmHints.icon_window != None))
{
WindowPtr icon = nxagentWindowPtr(wmHints.icon_window);
@@ -986,7 +1011,7 @@ void nxagentImportProperty(Window window,
}
}
- if ((wmHints.flags & IconMaskHint) && (wmHints.icon_mask =! None))
+ if ((wmHints.flags & IconMaskHint) && (wmHints.icon_mask != None))
{
PixmapPtr icon = nxagentPixmapPtr(wmHints.icon_mask);
@@ -1036,7 +1061,7 @@ void nxagentImportProperty(Window window,
if (atoms == NULL)
{
#ifdef WARNING
- fprintf(stderr, "nxagentImportProperty: WARNING! Malloc failed bailing out.\n");
+ fprintf(stderr, "nxagentImportProperty: WARNING! malloc() failed for '%s' - bailing out.\n", typeS);
#endif
return;
@@ -1066,6 +1091,14 @@ void nxagentImportProperty(Window window,
WindowPtr pWindow;
int i;
+ if (!wind)
+ {
+ #ifdef WARNING
+ fprintf(stderr, "nxagentImportProperty: WARNING! malloc() failed for '%s' - bailing out.\n", typeS);
+ #endif
+
+ return;
+ }
freeMem = True;
import = True;
output = (char*) wind;
@@ -1184,7 +1217,7 @@ void nxagentAddPropertyToList(Atom property, WindowPtr pWin)
if ((tmp = malloc(sizeof(struct nxagentPropertyRec))) == NULL)
{
- FatalError("nxagentAddPropertyToList: malloc failed.");
+ FatalError("nxagentAddPropertyToList: malloc() failed.");
}
#ifdef TEST