Commit d0a6c98c authored by Ulrich Sibiller's avatar Ulrich Sibiller

Window.c: use SAFE_free and SAFE_XFree

parent 4a826d30
...@@ -63,6 +63,7 @@ ...@@ -63,6 +63,7 @@
#include "Init.h" #include "Init.h"
#include "Composite.h" #include "Composite.h"
#include "Events.h" #include "Events.h"
#include "Utils.h"
#include <nx/NX.h> #include <nx/NX.h>
#include "compext/Compext.h" #include "compext/Compext.h"
...@@ -1482,10 +1483,7 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) ...@@ -1482,10 +1483,7 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask)
fprintf(stderr, "nxagentConfigureWindow: Failed QueryTree request.\n "); fprintf(stderr, "nxagentConfigureWindow: Failed QueryTree request.\n ");
} }
if (children_return) SAFE_XFree(children_return);
{
XFree(children_return);
}
} }
#endif #endif
} }
...@@ -3183,7 +3181,7 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer ...@@ -3183,7 +3181,7 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer
&hints); &hints);
#ifdef _XSERVER64 #ifdef _XSERVER64
free(data64); SAFE_free(data64);
#endif #endif
} }
} }
...@@ -3430,7 +3428,7 @@ Bool nxagentCheckWindowIntegrity(WindowPtr pWin) ...@@ -3430,7 +3428,7 @@ Bool nxagentCheckWindowIntegrity(WindowPtr pWin)
XDestroyImage(image); XDestroyImage(image);
} }
free(data); SAFE_free(data);
} }
else else
{ {
...@@ -3519,14 +3517,14 @@ void nxagentFlushConfigureWindow(void) ...@@ -3519,14 +3517,14 @@ void nxagentFlushConfigureWindow(void)
if (index == nxagentConfiguredWindowList) if (index == nxagentConfiguredWindowList)
{ {
free(index); SAFE_free(index);
break; break;
} }
else else
{ {
ConfiguredWindowStruct *tmp = index; ConfiguredWindowStruct *tmp = index;
index = index -> prev; index = index -> prev;
free(tmp); SAFE_free(tmp);
} }
} }
...@@ -3676,16 +3674,14 @@ void nxagentDeleteConfiguredWindow(WindowPtr pWin) ...@@ -3676,16 +3674,14 @@ void nxagentDeleteConfiguredWindow(WindowPtr pWin)
{ {
if (index -> prev == NULL && index -> next == NULL) if (index -> prev == NULL && index -> next == NULL)
{ {
free(nxagentConfiguredWindowList); SAFE_free(nxagentConfiguredWindowList);
nxagentConfiguredWindowList = NULL;
return; return;
} }
else if (index -> prev == NULL) else if (index -> prev == NULL)
{ {
tmp = nxagentConfiguredWindowList; tmp = nxagentConfiguredWindowList;
index = nxagentConfiguredWindowList = tmp -> next; index = nxagentConfiguredWindowList = tmp -> next;
free(tmp); SAFE_free(tmp);
nxagentConfiguredWindowList -> prev = NULL; nxagentConfiguredWindowList -> prev = NULL;
continue; continue;
...@@ -3694,7 +3690,7 @@ void nxagentDeleteConfiguredWindow(WindowPtr pWin) ...@@ -3694,7 +3690,7 @@ void nxagentDeleteConfiguredWindow(WindowPtr pWin)
{ {
tmp = index; tmp = index;
index = index -> prev; index = index -> prev;
free(tmp); SAFE_free(tmp);
index -> next = NULL; index -> next = NULL;
return; return;
...@@ -3705,7 +3701,7 @@ void nxagentDeleteConfiguredWindow(WindowPtr pWin) ...@@ -3705,7 +3701,7 @@ void nxagentDeleteConfiguredWindow(WindowPtr pWin)
index = index -> next; index = index -> next;
previous -> next = index; previous -> next = index;
index -> prev = previous; index -> prev = previous;
free(tmp); SAFE_free(tmp);
continue; continue;
} }
...@@ -3747,16 +3743,14 @@ void nxagentDeleteStaticResizedWindow(unsigned long sequence) ...@@ -3747,16 +3743,14 @@ void nxagentDeleteStaticResizedWindow(unsigned long sequence)
{ {
if (index -> prev == NULL && index -> next == NULL) if (index -> prev == NULL && index -> next == NULL)
{ {
free(nxagentStaticResizedWindowList); SAFE_free(nxagentStaticResizedWindowList);
nxagentStaticResizedWindowList = NULL;
return; return;
} }
else if (index -> prev == NULL) else if (index -> prev == NULL)
{ {
tmp = nxagentStaticResizedWindowList; tmp = nxagentStaticResizedWindowList;
index = nxagentStaticResizedWindowList = tmp -> next; index = nxagentStaticResizedWindowList = tmp -> next;
free(tmp); SAFE_free(tmp);
nxagentStaticResizedWindowList -> prev = NULL; nxagentStaticResizedWindowList -> prev = NULL;
continue; continue;
...@@ -3765,7 +3759,7 @@ void nxagentDeleteStaticResizedWindow(unsigned long sequence) ...@@ -3765,7 +3759,7 @@ void nxagentDeleteStaticResizedWindow(unsigned long sequence)
{ {
tmp = index; tmp = index;
index = index -> prev; index = index -> prev;
free(tmp); SAFE_free(tmp);
index -> next = NULL; index -> next = NULL;
return; return;
...@@ -3776,7 +3770,7 @@ void nxagentDeleteStaticResizedWindow(unsigned long sequence) ...@@ -3776,7 +3770,7 @@ void nxagentDeleteStaticResizedWindow(unsigned long sequence)
index = index -> next; index = index -> next;
previous -> next = index; previous -> next = index;
index -> prev = previous; index -> prev = previous;
free(tmp); SAFE_free(tmp);
continue; continue;
} }
...@@ -3909,8 +3903,7 @@ int nxagentRemoveItemBSPixmapList(unsigned long pixmapId) ...@@ -3909,8 +3903,7 @@ int nxagentRemoveItemBSPixmapList(unsigned long pixmapId)
if ((nxagentBSPixmapList[i] != NULL) && if ((nxagentBSPixmapList[i] != NULL) &&
(nxagentBSPixmapList[i] -> storingPixmapId == pixmapId)) (nxagentBSPixmapList[i] -> storingPixmapId == pixmapId))
{ {
free(nxagentBSPixmapList[i]); SAFE_free(nxagentBSPixmapList[i]);
nxagentBSPixmapList[i] = NULL;
if (i < BSPIXMAPLIMIT - 1) if (i < BSPIXMAPLIMIT - 1)
{ {
...@@ -3948,8 +3941,7 @@ int nxagentEmptyBSPixmapList(void) ...@@ -3948,8 +3941,7 @@ int nxagentEmptyBSPixmapList(void)
{ {
for (int i = 0; i < BSPIXMAPLIMIT; i++) for (int i = 0; i < BSPIXMAPLIMIT; i++)
{ {
free(nxagentBSPixmapList[i]); SAFE_free(nxagentBSPixmapList[i]);
nxagentBSPixmapList[i] = NULL;
} }
return 1; return 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment