aboutsummaryrefslogtreecommitdiff
path: root/nx-X11
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2020-10-02 21:31:58 +0200
committerUlrich Sibiller <uli42@gmx.de>2020-11-03 19:53:07 +0100
commit447ee15707c022b6fd9061ce0df3a960fe24fb80 (patch)
treecf4756ebfaf8172e5fc76762440459b1ea5a786c /nx-X11
parentedb5a918a8a79262ce0bfd3924f6a5bb268877cd (diff)
downloadnx-libs-447ee15707c022b6fd9061ce0df3a960fe24fb80.tar.gz
nx-libs-447ee15707c022b6fd9061ce0df3a960fe24fb80.tar.bz2
nx-libs-447ee15707c022b6fd9061ce0df3a960fe24fb80.zip
Compext.c: use SAFE_free macro
Diffstat (limited to 'nx-X11')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c241
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/compext/Jpeg.c6
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/compext/Png.c22
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/compext/Z.c6
4 files changed, 106 insertions, 169 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c b/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c
index 3492ef473..f65624c5a 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c
@@ -69,6 +69,7 @@
#include "Rle.h"
#include "Z.h"
+#include "../Utils.h"
#define PANIC
#define WARNING
@@ -345,7 +346,7 @@ int _NXInternalResetResources(Display *dpy)
{
DeqAsyncHandler(dpy, _NXCollectedImages[i] -> handler);
- free(_NXCollectedImages[i] -> handler);
+ SAFE_free(_NXCollectedImages[i] -> handler);
}
if (_NXCollectedImages[i] -> image != NULL)
@@ -353,9 +354,7 @@ int _NXInternalResetResources(Display *dpy)
XDestroyImage(_NXCollectedImages[i] -> image);
}
- free(_NXCollectedImages[i]);
-
- _NXCollectedImages[i] = NULL;
+ SAFE_free(_NXCollectedImages[i]);
}
if (_NXCollectedProperties[i] != NULL)
@@ -369,17 +368,12 @@ int _NXInternalResetResources(Display *dpy)
{
DeqAsyncHandler(dpy, _NXCollectedProperties[i] -> handler);
- free(_NXCollectedProperties[i] -> handler);
- }
-
- if (_NXCollectedProperties[i] -> data != NULL)
- {
- free(_NXCollectedProperties[i] -> data);
+ SAFE_free(_NXCollectedProperties[i] -> handler);
}
- free(_NXCollectedProperties[i]);
+ SAFE_free(_NXCollectedProperties[i] -> data);
- _NXCollectedProperties[i] = NULL;
+ SAFE_free(_NXCollectedProperties[i]);
}
if (_NXCollectedGrabPointers[i] != NULL)
@@ -393,12 +387,10 @@ int _NXInternalResetResources(Display *dpy)
{
DeqAsyncHandler(dpy, _NXCollectedGrabPointers[i] -> handler);
- free(_NXCollectedGrabPointers[i] -> handler);
+ SAFE_free(_NXCollectedGrabPointers[i] -> handler);
}
- free(_NXCollectedGrabPointers[i]);
-
- _NXCollectedGrabPointers[i] = NULL;
+ SAFE_free(_NXCollectedGrabPointers[i]);
}
if (_NXCollectedInputFocuses[i] != NULL)
@@ -412,12 +404,10 @@ int _NXInternalResetResources(Display *dpy)
{
DeqAsyncHandler(dpy, _NXCollectedInputFocuses[i] -> handler);
- free(_NXCollectedInputFocuses[i] -> handler);
+ SAFE_free(_NXCollectedInputFocuses[i] -> handler);
}
- free(_NXCollectedInputFocuses[i]);
-
- _NXCollectedInputFocuses[i] = NULL;
+ SAFE_free(_NXCollectedInputFocuses[i]);
}
}
@@ -488,10 +478,7 @@ int NXSetDisplayBuffer(Display *dpy, int size)
return -1;
}
- if (dpy -> buffer != NULL)
- {
- free(dpy -> buffer);
- }
+ SAFE_free(dpy -> buffer);
dpy -> buffer = buffer;
dpy -> bufptr = dpy -> buffer;
@@ -2190,7 +2177,7 @@ NXPackedImage *NXPackImage(Display *dpy, XImage *src_image, unsigned int method)
dst_data_size);
#endif
- free(dst_image);
+ SAFE_free(dst_image);
return NULL;
}
@@ -2224,9 +2211,9 @@ NXPackedImage *NXPackImage(Display *dpy, XImage *src_image, unsigned int method)
fprintf(stderr, "******NXPackImage: PANIC! Failed to clean the image.\n");
#endif
- free(dst_image -> data);
+ SAFE_free(dst_image -> data);
- free(dst_image);
+ SAFE_free(dst_image);
return NULL;
}
@@ -2237,9 +2224,9 @@ NXPackedImage *NXPackImage(Display *dpy, XImage *src_image, unsigned int method)
fprintf(stderr, "******NXPackImage: PANIC! Failed to apply the color mask.\n");
#endif
- free(dst_image -> data);
+ SAFE_free(dst_image -> data);
- free(dst_image);
+ SAFE_free(dst_image);
return NULL;
}
@@ -2273,9 +2260,9 @@ NXPackedImage *NXPackImage(Display *dpy, XImage *src_image, unsigned int method)
dst_bits_per_pixel, dst_packed_bits_per_pixel);
#endif
- free(dst_image -> data);
+ SAFE_free(dst_image -> data);
- free(dst_image);
+ SAFE_free(dst_image);
return NULL;
}
@@ -2397,7 +2384,7 @@ XImage *NXInPlacePackImage(Display *dpy, XImage *src_image, unsigned int method)
fprintf(stderr, "******NXInPlacePackImage: PANIC! Failed to clean the image.\n");
#endif
- free(dst_image);
+ SAFE_free(dst_image);
return NULL;
}
@@ -2408,7 +2395,7 @@ XImage *NXInPlacePackImage(Display *dpy, XImage *src_image, unsigned int method)
fprintf(stderr, "******NXInPlacePackImage: PANIC! Failed to apply the color mask.\n");
#endif
- free(dst_image);
+ SAFE_free(dst_image);
return NULL;
}
@@ -2671,7 +2658,7 @@ NXPackedImage *NXEncodeRgb(XImage *src_image, unsigned int method, unsigned int
fprintf(stderr, "******NXEncodeRgb: PANIC! Rgb compression failed.\n");
#endif
- free(dst_image);
+ SAFE_free(dst_image);
return NULL;
}
@@ -2716,7 +2703,7 @@ NXPackedImage *NXEncodeRle(XImage *src_image, unsigned int method, unsigned int
fprintf(stderr, "******NXEncodeRle: PANIC! Rle compression failed.\n");
#endif
- free(dst_image);
+ SAFE_free(dst_image);
return NULL;
}
@@ -2761,7 +2748,7 @@ NXPackedImage *NXEncodeBitmap(XImage *src_image, unsigned int method, unsigned i
fprintf(stderr, "******NXEncodeBitmap: PANIC! Bitmap compression failed.\n");
#endif
- free(dst_image);
+ SAFE_free(dst_image);
return NULL;
}
@@ -2821,7 +2808,7 @@ NXPackedImage *NXEncodeJpeg(XImage *src_image, unsigned int method, unsigned int
fprintf(stderr, "******NXEncodeJpeg: PANIC! Jpeg compression failed.\n");
#endif
- free(dst_image);
+ SAFE_free(dst_image);
return NULL;
}
@@ -2876,7 +2863,7 @@ NXPackedImage *NXEncodePng(XImage *src_image, unsigned int method, unsigned int
fprintf(stderr, "******NXEncodePng: PANIC! Png compression failed.\n");
#endif
- free(dst_image);
+ SAFE_free(dst_image);
return NULL;
}
@@ -3151,12 +3138,7 @@ void NXInitCache(Display *dpy, int entries)
NXImageCacheSize = 0;
- if (NXImageCache != NULL)
- {
- free(NXImageCache);
-
- NXImageCache = NULL;
- }
+ SAFE_free(NXImageCache);
if (entries > 0)
{
@@ -3267,7 +3249,7 @@ XImage *NXCacheFindImage(NXPackedImage *src_image, unsigned int *method, unsigne
i, NXImageCacheHits, NXImageCacheOps);
#endif
- free(new_md5);
+ SAFE_free(new_md5);
/*
* Move the images down one slot, from
@@ -3344,9 +3326,9 @@ int NXCacheAddImage(NXPackedImage *image, unsigned int method, unsigned char *md
i--;
- free(NXImageCache[NXImageCacheSize - 1].image -> data);
- free(NXImageCache[NXImageCacheSize - 1].image);
- free(NXImageCache[NXImageCacheSize - 1].md5);
+ SAFE_free(NXImageCache[NXImageCacheSize - 1].image -> data);
+ SAFE_free(NXImageCache[NXImageCacheSize - 1].image);
+ SAFE_free(NXImageCache[NXImageCacheSize - 1].md5);
}
if (i > 0)
@@ -3400,27 +3382,14 @@ void NXFreeCache(Display *dpy)
{
if (NXImageCache[i].image != NULL)
{
- if (NXImageCache[i].image -> data != NULL)
- {
- free(NXImageCache[i].image -> data);
- }
-
- free(NXImageCache[i].image);
-
- NXImageCache[i].image = NULL;
+ SAFE_free(NXImageCache[i].image -> data);
+ SAFE_free(NXImageCache[i].image);
}
- if (NXImageCache[i].md5 != NULL)
- {
- free(NXImageCache[i].md5);
-
- NXImageCache[i].md5 = NULL;
- }
+ SAFE_free(NXImageCache[i].md5);
}
- free(NXImageCache);
-
- NXImageCache = NULL;
+ SAFE_free(NXImageCache);
NXImageCacheSize = 0;
NXImageCacheHits = 0;
@@ -3490,9 +3459,7 @@ static Bool _NXCollectImageHandler(Display *dpy, xReply *rep, char *buf,
DeqAsyncHandler(dpy, state -> handler);
- free(state -> handler);
-
- state -> handler = NULL;
+ SAFE_free(state -> handler);
if (rep -> generic.type == X_Error)
{
@@ -3505,7 +3472,7 @@ static Bool _NXCollectImageHandler(Display *dpy, xReply *rep, char *buf,
_NXCollectedImages[state -> resource] = NULL;
- free(state);
+ SAFE_free(state);
return False;
}
@@ -3530,7 +3497,7 @@ static Bool _NXCollectImageHandler(Display *dpy, xReply *rep, char *buf,
_NXCollectedImages[state -> resource] = NULL;
- free(state);
+ SAFE_free(state);
return False;
}
@@ -3553,9 +3520,9 @@ static Bool _NXCollectImageHandler(Display *dpy, xReply *rep, char *buf,
_NXCollectedImages[state -> resource] = NULL;
- free(state);
+ SAFE_free(state);
- free(async_head);
+ SAFE_free(async_head);
return False;
}
@@ -3582,9 +3549,9 @@ static Bool _NXCollectImageHandler(Display *dpy, xReply *rep, char *buf,
_NXCollectedImages[state -> resource] = NULL;
- free(state);
+ SAFE_free(state);
- free(async_head);
+ SAFE_free(async_head);
return False;
}
@@ -3628,10 +3595,10 @@ static Bool _NXCollectImageHandler(Display *dpy, xReply *rep, char *buf,
_NXCollectedImages[state -> resource] = NULL;
- free(state);
+ SAFE_free(state);
- free(async_head);
- free(async_data);
+ SAFE_free(async_head);
+ SAFE_free(async_data);
return True;
}
@@ -3651,7 +3618,7 @@ static Bool _NXCollectImageHandler(Display *dpy, xReply *rep, char *buf,
_NXNotifyImage(dpy, state -> resource, True);
- free(async_head);
+ SAFE_free(async_head);
return True;
}
@@ -3703,7 +3670,7 @@ int NXCollectImage(Display *dpy, unsigned int resource, Drawable drawable,
{
DeqAsyncHandler(dpy, state -> handler);
- free(state -> handler);
+ SAFE_free(state -> handler);
}
if (state -> image != NULL)
@@ -3711,7 +3678,7 @@ int NXCollectImage(Display *dpy, unsigned int resource, Drawable drawable,
XDestroyImage(state -> image);
}
- free(state);
+ SAFE_free(state);
_NXCollectedImages[resource] = NULL;
}
@@ -3751,15 +3718,8 @@ int NXCollectImage(Display *dpy, unsigned int resource, Drawable drawable,
UnGetReq(GetImage);
- if (state != NULL)
- {
- free(state);
- }
-
- if (handler != NULL)
- {
- free(handler);
- }
+ SAFE_free(state);
+ SAFE_free(handler);
UnlockDisplay(dpy);
@@ -3810,7 +3770,7 @@ int NXGetCollectedImage(Display *dpy, unsigned int resource, XImage **image)
*image = state -> image;
- free(state);
+ SAFE_free(state);
#ifdef TEST
fprintf(stderr, "******NXGetCollectedImage: Returning GetImage data for resource [%u].\n",
@@ -3883,9 +3843,7 @@ static Bool _NXCollectPropertyHandler(Display *dpy, xReply *rep, char *buf,
DeqAsyncHandler(dpy, state -> handler);
- free(state -> handler);
-
- state -> handler = NULL;
+ SAFE_free(state -> handler);
if (rep -> generic.type == X_Error)
{
@@ -3898,7 +3856,7 @@ static Bool _NXCollectPropertyHandler(Display *dpy, xReply *rep, char *buf,
_NXCollectedProperties[state -> resource] = NULL;
- free(state);
+ SAFE_free(state);
return False;
}
@@ -3923,7 +3881,7 @@ static Bool _NXCollectPropertyHandler(Display *dpy, xReply *rep, char *buf,
_NXCollectedProperties[state -> resource] = NULL;
- free(state);
+ SAFE_free(state);
return False;
}
@@ -3946,9 +3904,9 @@ static Bool _NXCollectPropertyHandler(Display *dpy, xReply *rep, char *buf,
_NXCollectedProperties[state -> resource] = NULL;
- free(state);
+ SAFE_free(state);
- free(async_head);
+ SAFE_free(async_head);
return False;
}
@@ -3983,9 +3941,9 @@ static Bool _NXCollectPropertyHandler(Display *dpy, xReply *rep, char *buf,
_NXCollectedProperties[state -> resource] = NULL;
- free(state);
+ SAFE_free(state);
- free(async_head);
+ SAFE_free(async_head);
return False;
}
@@ -4019,7 +3977,7 @@ static Bool _NXCollectPropertyHandler(Display *dpy, xReply *rep, char *buf,
_NXNotifyProperty(dpy, state -> resource, True);
- free(async_head);
+ SAFE_free(async_head);
return True;
}
@@ -4070,15 +4028,11 @@ int NXCollectProperty(Display *dpy, unsigned int resource, Window window, Atom p
{
DeqAsyncHandler(dpy, state -> handler);
- free(state -> handler);
+ SAFE_free(state -> handler);
}
- if (state -> data != NULL)
- {
- free(state -> data);
- }
-
- free(state);
+ SAFE_free(state->data);
+ SAFE_free(state);
_NXCollectedProperties[resource] = NULL;
}
@@ -4115,15 +4069,8 @@ int NXCollectProperty(Display *dpy, unsigned int resource, Window window, Atom p
resource);
#endif
- if (state != NULL)
- {
- free(state);
- }
-
- if (handler != NULL)
- {
- free(handler);
- }
+ SAFE_free(state);
+ SAFE_free(handler);
UnGetReq(GetProperty);
@@ -4183,7 +4130,7 @@ int NXGetCollectedProperty(Display *dpy, unsigned int resource, Atom *actual_typ
*data = (unsigned char *) _NXCollectedProperties[resource] -> data;
- free(state);
+ SAFE_free(state);
_NXCollectedProperties[resource] = NULL;
@@ -4245,9 +4192,7 @@ static Bool _NXCollectGrabPointerHandler(Display *dpy, xReply *rep, char *buf,
DeqAsyncHandler(dpy, state -> handler);
- free(state -> handler);
-
- state -> handler = NULL;
+ SAFE_free(state -> handler);
if (rep -> generic.type == X_Error)
{
@@ -4260,7 +4205,7 @@ static Bool _NXCollectGrabPointerHandler(Display *dpy, xReply *rep, char *buf,
_NXCollectedGrabPointers[state -> resource] = NULL;
- free(state);
+ SAFE_free(state);
return False;
}
@@ -4285,7 +4230,7 @@ static Bool _NXCollectGrabPointerHandler(Display *dpy, xReply *rep, char *buf,
_NXCollectedGrabPointers[state -> resource] = NULL;
- free(state);
+ SAFE_free(state);
return False;
}
@@ -4308,9 +4253,9 @@ static Bool _NXCollectGrabPointerHandler(Display *dpy, xReply *rep, char *buf,
_NXCollectedGrabPointers[state -> resource] = NULL;
- free(state);
+ SAFE_free(state);
- free(async_head);
+ SAFE_free(async_head);
return False;
}
@@ -4324,7 +4269,7 @@ static Bool _NXCollectGrabPointerHandler(Display *dpy, xReply *rep, char *buf,
_NXNotifyGrabPointer(dpy, state -> resource, True);
- free(async_head);
+ SAFE_free(async_head);
return True;
}
@@ -4376,10 +4321,10 @@ int NXCollectGrabPointer(Display *dpy, unsigned int resource, Window grab_window
{
DeqAsyncHandler(dpy, state -> handler);
- free(state -> handler);
+ SAFE_free(state -> handler);
}
- free(state);
+ SAFE_free(state);
_NXCollectedGrabPointers[resource] = NULL;
}
@@ -4412,15 +4357,9 @@ int NXCollectGrabPointer(Display *dpy, unsigned int resource, Window grab_window
resource);
#endif
- if (state != NULL)
- {
- free(state);
- }
+ SAFE_free(state);
- if (handler != NULL)
- {
- free(handler);
- }
+ SAFE_free(handler);
UnGetReq(GrabPointer);
@@ -4467,7 +4406,7 @@ int NXGetCollectedGrabPointer(Display *dpy, unsigned int resource, int *status)
*status = state -> status;
- free(state);
+ SAFE_free(state);
_NXCollectedGrabPointers[resource] = NULL;
@@ -4529,9 +4468,7 @@ static Bool _NXCollectInputFocusHandler(Display *dpy, xReply *rep, char *buf,
DeqAsyncHandler(dpy, state -> handler);
- free(state -> handler);
-
- state -> handler = NULL;
+ SAFE_free(state -> handler);
if (rep -> generic.type == X_Error)
{
@@ -4544,7 +4481,7 @@ static Bool _NXCollectInputFocusHandler(Display *dpy, xReply *rep, char *buf,
_NXCollectedInputFocuses[state -> resource] = NULL;
- free(state);
+ SAFE_free(state);
return False;
}
@@ -4569,7 +4506,7 @@ static Bool _NXCollectInputFocusHandler(Display *dpy, xReply *rep, char *buf,
_NXCollectedInputFocuses[state -> resource] = NULL;
- free(state);
+ SAFE_free(state);
return False;
}
@@ -4592,9 +4529,9 @@ static Bool _NXCollectInputFocusHandler(Display *dpy, xReply *rep, char *buf,
_NXCollectedInputFocuses[state -> resource] = NULL;
- free(state);
+ SAFE_free(state);
- free(async_head);
+ SAFE_free(async_head);
return False;
}
@@ -4610,7 +4547,7 @@ static Bool _NXCollectInputFocusHandler(Display *dpy, xReply *rep, char *buf,
_NXNotifyInputFocus(dpy, state -> resource, True);
- free(async_head);
+ SAFE_free(async_head);
return True;
}
@@ -4660,10 +4597,10 @@ int NXCollectInputFocus(Display *dpy, unsigned int resource)
{
DeqAsyncHandler(dpy, state -> handler);
- free(state -> handler);
+ SAFE_free(state -> handler);
}
- free(state);
+ SAFE_free(state);
_NXCollectedInputFocuses[resource] = NULL;
}
@@ -4687,15 +4624,9 @@ int NXCollectInputFocus(Display *dpy, unsigned int resource)
resource);
#endif
- if (state != NULL)
- {
- free(state);
- }
+ SAFE_free(state);
- if (handler != NULL)
- {
- free(handler);
- }
+ SAFE_free(handler);
UnGetEmptyReq();
@@ -4745,7 +4676,7 @@ int NXGetCollectedInputFocus(Display *dpy, unsigned int resource,
*focus_return = state -> focus;
*revert_to_return = state -> revert_to;
- free(state);
+ SAFE_free(state);
_NXCollectedInputFocuses[resource] = NULL;
diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Jpeg.c b/nx-X11/programs/Xserver/hw/nxagent/compext/Jpeg.c
index 690a934f6..bdf3d927a 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/compext/Jpeg.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Jpeg.c
@@ -38,6 +38,8 @@
#include "Mask.h"
#include "Jpeg.h"
+#include "../Utils.h"
+
#define PANIC
#define WARNING
#undef TEST
@@ -277,7 +279,7 @@ char *JpegCompressData(XImage *image, int level, int *compressed_size)
jpegError);
#endif
- free(jpegCompBuf);
+ SAFE_free(jpegCompBuf);
return NULL;
}
@@ -326,7 +328,7 @@ char *JpegCompressData(XImage *image, int level, int *compressed_size)
jpegDstDataLen);
#endif
- free(jpegCompBuf);
+ SAFE_free(jpegCompBuf);
return NULL;
}
diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Png.c b/nx-X11/programs/Xserver/hw/nxagent/compext/Png.c
index 5c3a27612..00f6769f8 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/compext/Png.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Png.c
@@ -34,6 +34,8 @@
#include "Mask.h"
#include "Png.h"
+#include "../Utils.h"
+
#define PANIC
#define WARNING
#undef TEST
@@ -361,7 +363,7 @@ char *PngCompressData(XImage *image, int *compressed_size)
#endif
png_destroy_write_struct(&png_ptr, &info_ptr);
- free(pngCompBuf);
+ SAFE_free(pngCompBuf);
return NULL;
}
@@ -373,7 +375,7 @@ char *PngCompressData(XImage *image, int *compressed_size)
fprintf(stderr, "******PngCompressData: PANIC! Could not alloc image_index.\n");
#endif
- free(pngCompBuf);
+ SAFE_free(pngCompBuf);
return NULL;
}
@@ -475,8 +477,8 @@ char *PngCompressData(XImage *image, int *compressed_size)
png_destroy_write_struct(&png_ptr, &info_ptr);
- free(pngCompBuf);
- free(image_index);
+ SAFE_free(pngCompBuf);
+ SAFE_free(image_index);
return NULL;
}
@@ -500,8 +502,8 @@ char *PngCompressData(XImage *image, int *compressed_size)
(int) (count * sizeof(CARD8)));
#endif
- free(pngCompBuf);
- free(image_index);
+ SAFE_free(pngCompBuf);
+ SAFE_free(image_index);
return NULL;
}
@@ -532,8 +534,8 @@ char *PngCompressData(XImage *image, int *compressed_size)
dy, h);
#endif
- free(srcBuf); srcBuf = NULL;
- free(image_index); image_index = NULL;
+ SAFE_free(srcBuf);
+ SAFE_free(image_index);
if (setjmp(png_jmpbuf(png_ptr)))
{
@@ -543,7 +545,7 @@ char *PngCompressData(XImage *image, int *compressed_size)
png_destroy_write_struct(&png_ptr, &info_ptr);
- free(pngCompBuf);
+ SAFE_free(pngCompBuf);
return NULL;
}
@@ -594,7 +596,7 @@ char *PngCompressData(XImage *image, int *compressed_size)
pngDataLen);
#endif
- free(pngCompBuf);
+ SAFE_free(pngCompBuf);
return NULL;
}
diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Z.c b/nx-X11/programs/Xserver/hw/nxagent/compext/Z.c
index 9bf59eaf2..978032c28 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/compext/Z.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Z.c
@@ -33,6 +33,8 @@
#include "Z.h"
+#include "../Utils.h"
+
#define PANIC
#define WARNING
#undef TEST
@@ -129,7 +131,7 @@ char *ZCompressData(const char *plainData, unsigned int plainSize, int threshold
plainSize, zError(result));
#endif
- free(compressedData);
+ SAFE_free(compressedData);
*compressedSize = 0;
@@ -300,7 +302,7 @@ int ZResetEncoder(void)
#endif
}
- free(zStream);
+ SAFE_free(zStream);
}
zInitialized = 0;