diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2019-08-27 08:27:42 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2019-08-27 08:27:42 +0200 |
commit | 6f80a06fb96725e7eadf846bf0e727821aadbf47 (patch) | |
tree | 64846b3be22e28618ffe285db02d55fa5d4de709 /nx-X11/programs/Xserver/hw/nxagent/Window.c | |
parent | 8b15d574b49857cdf4df0fd813d68b750d8aee5f (diff) | |
parent | f39b81d31bc7d0427ea9cca04d0e4a21579d7383 (diff) | |
download | nx-libs-6f80a06fb96725e7eadf846bf0e727821aadbf47.tar.gz nx-libs-6f80a06fb96725e7eadf846bf0e727821aadbf47.tar.bz2 nx-libs-6f80a06fb96725e7eadf846bf0e727821aadbf47.zip |
Merge branch 'uli42-pr/safe_free' into 3.6.x
Attributes GH PR #826: https://github.com/ArcticaProject/nx-libs/pull/826
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/Window.c')
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Window.c | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index 192feec40..59b33b6be 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -63,6 +63,7 @@ #include "Init.h" #include "Composite.h" #include "Events.h" +#include "Utils.h" #include <nx/NX.h> #include "compext/Compext.h" @@ -1430,10 +1431,7 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) fprintf(stderr, "nxagentConfigureWindow: Failed QueryTree request.\n "); } - if (children_return) - { - XFree(children_return); - } + SAFE_XFree(children_return); } #endif } @@ -3129,7 +3127,7 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer &hints); #ifdef _XSERVER64 - free(data64); + SAFE_free(data64); #endif } } @@ -3376,7 +3374,7 @@ Bool nxagentCheckWindowIntegrity(WindowPtr pWin) XDestroyImage(image); } - free(data); + SAFE_free(data); } else { @@ -3465,14 +3463,14 @@ void nxagentFlushConfigureWindow(void) if (index == nxagentConfiguredWindowList) { - free(index); + SAFE_free(index); break; } else { ConfiguredWindowStruct *tmp = index; index = index -> prev; - free(tmp); + SAFE_free(tmp); } } @@ -3622,16 +3620,14 @@ void nxagentDeleteConfiguredWindow(WindowPtr pWin) { if (index -> prev == NULL && index -> next == NULL) { - free(nxagentConfiguredWindowList); - nxagentConfiguredWindowList = NULL; - + SAFE_free(nxagentConfiguredWindowList); return; } else if (index -> prev == NULL) { tmp = nxagentConfiguredWindowList; index = nxagentConfiguredWindowList = tmp -> next; - free(tmp); + SAFE_free(tmp); nxagentConfiguredWindowList -> prev = NULL; continue; @@ -3640,7 +3636,7 @@ void nxagentDeleteConfiguredWindow(WindowPtr pWin) { tmp = index; index = index -> prev; - free(tmp); + SAFE_free(tmp); index -> next = NULL; return; @@ -3651,7 +3647,7 @@ void nxagentDeleteConfiguredWindow(WindowPtr pWin) index = index -> next; previous -> next = index; index -> prev = previous; - free(tmp); + SAFE_free(tmp); continue; } @@ -3693,16 +3689,14 @@ void nxagentDeleteStaticResizedWindow(unsigned long sequence) { if (index -> prev == NULL && index -> next == NULL) { - free(nxagentStaticResizedWindowList); - nxagentStaticResizedWindowList = NULL; - + SAFE_free(nxagentStaticResizedWindowList); return; } else if (index -> prev == NULL) { tmp = nxagentStaticResizedWindowList; index = nxagentStaticResizedWindowList = tmp -> next; - free(tmp); + SAFE_free(tmp); nxagentStaticResizedWindowList -> prev = NULL; continue; @@ -3711,7 +3705,7 @@ void nxagentDeleteStaticResizedWindow(unsigned long sequence) { tmp = index; index = index -> prev; - free(tmp); + SAFE_free(tmp); index -> next = NULL; return; @@ -3722,7 +3716,7 @@ void nxagentDeleteStaticResizedWindow(unsigned long sequence) index = index -> next; previous -> next = index; index -> prev = previous; - free(tmp); + SAFE_free(tmp); continue; } @@ -3855,8 +3849,7 @@ int nxagentRemoveItemBSPixmapList(unsigned long pixmapId) if ((nxagentBSPixmapList[i] != NULL) && (nxagentBSPixmapList[i] -> storingPixmapId == pixmapId)) { - free(nxagentBSPixmapList[i]); - nxagentBSPixmapList[i] = NULL; + SAFE_free(nxagentBSPixmapList[i]); if (i < BSPIXMAPLIMIT - 1) { @@ -3894,8 +3887,7 @@ int nxagentEmptyBSPixmapList(void) { for (int i = 0; i < BSPIXMAPLIMIT; i++) { - free(nxagentBSPixmapList[i]); - nxagentBSPixmapList[i] = NULL; + SAFE_free(nxagentBSPixmapList[i]); } return 1; |