Commit dde4e763 authored by Ulrich Sibiller's avatar Ulrich Sibiller

Image.c: use SAFE_free

parent 45853801
...@@ -455,7 +455,7 @@ FIXME: Here the split trap is always set and so the caching of ...@@ -455,7 +455,7 @@ FIXME: Here the split trap is always set and so the caching of
if (nxagentUnpackAlpha[resource] != NULL) if (nxagentUnpackAlpha[resource] != NULL)
{ {
free(nxagentUnpackAlpha[resource] -> data); SAFE_free(nxagentUnpackAlpha[resource] -> data);
} }
else if ((nxagentUnpackAlpha[resource] = malloc(sizeof(UnpackAlphaRec))) == NULL) else if ((nxagentUnpackAlpha[resource] = malloc(sizeof(UnpackAlphaRec))) == NULL)
{ {
...@@ -463,7 +463,7 @@ FIXME: Here the split trap is always set and so the caching of ...@@ -463,7 +463,7 @@ FIXME: Here the split trap is always set and so the caching of
fprintf(stderr, "nxagentSetUnpackAlpha: PANIC! Can't allocate data for the alpha structure.\n"); fprintf(stderr, "nxagentSetUnpackAlpha: PANIC! Can't allocate data for the alpha structure.\n");
#endif #endif
free(data); SAFE_free(data);
return; return;
} }
...@@ -483,7 +483,7 @@ FIXME: Here the split trap is always set and so the caching of ...@@ -483,7 +483,7 @@ FIXME: Here the split trap is always set and so the caching of
resource, size); resource, size);
#endif #endif
free(data); SAFE_free(data);
} }
} }
...@@ -1567,20 +1567,20 @@ nxagentPutSubImageEnd: ...@@ -1567,20 +1567,20 @@ nxagentPutSubImageEnd:
nxagentImageStatistics.totalEncoded, nxagentImageStatistics.totalAdded); nxagentImageStatistics.totalEncoded, nxagentImageStatistics.totalAdded);
#endif #endif
free(packedChecksum); SAFE_free(packedChecksum);
if (packedImage != NULL) if (packedImage != NULL)
{ {
if (packedImage -> data != NULL && if (packedImage -> data != NULL &&
packedImage -> data != plainImage -> data) packedImage -> data != plainImage -> data)
{ {
free(packedImage -> data); SAFE_free(packedImage -> data);
} }
free(packedImage); SAFE_free(packedImage);
} }
free(plainImage); SAFE_free(plainImage);
} }
void nxagentGetImage(DrawablePtr pDrawable, int x, int y, int w, int h, void nxagentGetImage(DrawablePtr pDrawable, int x, int y, int w, int h,
...@@ -1634,11 +1634,8 @@ void nxagentResetAlphaCache(void) ...@@ -1634,11 +1634,8 @@ void nxagentResetAlphaCache(void)
{ {
if (nxagentUnpackAlpha[i]) if (nxagentUnpackAlpha[i])
{ {
free(nxagentUnpackAlpha[i] -> data); SAFE_free(nxagentUnpackAlpha[i] -> data);
SAFE_free(nxagentUnpackAlpha[i]);
free(nxagentUnpackAlpha[i]);
nxagentUnpackAlpha[i] = NULL;
} }
} }
} }
...@@ -1716,7 +1713,7 @@ int nxagentScaleImage(int x, int y, unsigned xRatio, unsigned yRatio, ...@@ -1716,7 +1713,7 @@ int nxagentScaleImage(int x, int y, unsigned xRatio, unsigned yRatio,
if (newImage -> data == NULL) if (newImage -> data == NULL)
{ {
free(newImage); SAFE_free(newImage);
#ifdef PANIC #ifdef PANIC
fprintf(stderr, "nxagentScaleImage: PANIC! Failed to create the target image data.\n"); fprintf(stderr, "nxagentScaleImage: PANIC! Failed to create the target image data.\n");
...@@ -1784,8 +1781,8 @@ int nxagentScaleImage(int x, int y, unsigned xRatio, unsigned yRatio, ...@@ -1784,8 +1781,8 @@ int nxagentScaleImage(int x, int y, unsigned xRatio, unsigned yRatio,
} }
} }
free((char *) image -> obdata); SAFE_free(image -> obdata);
free((char *) image); SAFE_free(image);
*pImage = newImage; *pImage = newImage;
......
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