summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2003-12-31 01:01:44 +0000
committerIlia Alshanetsky <iliaa@php.net>2003-12-31 01:01:44 +0000
commitf4a07dd9a50f995441c2f7dc5b4279d98b83074f (patch)
treeab54abb9578b600eca820a96917f235e74eff97e /ext
parent51fc89e49c37a5f55dc5658d0f8001d24ec17605 (diff)
downloadphp-git-f4a07dd9a50f995441c2f7dc5b4279d98b83074f.tar.gz
Replace regular malloc with safe_emalloc in several places.
Diffstat (limited to 'ext')
-rw-r--r--ext/gd/libgd/gd_topal.c10
-rw-r--r--ext/gd/libgd/wbmp.c2
2 files changed, 6 insertions, 6 deletions
diff --git a/ext/gd/libgd/gd_topal.c b/ext/gd/libgd/gd_topal.c
index b2c64d9ba8..68c74aa403 100644
--- a/ext/gd/libgd/gd_topal.c
+++ b/ext/gd/libgd/gd_topal.c
@@ -765,7 +765,7 @@ select_colors (gdImagePtr im, my_cquantize_ptr cquantize, int desired_colors)
#ifdef ORIGINAL_LIB_JPEG
boxlist = (boxptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, desired_colors * SIZEOF (box));
#else
- boxlist = (boxptr) gdMalloc (desired_colors * sizeof (box));
+ boxlist = (boxptr) safe_emalloc(desired_colors, sizeof(box), 1);
#endif
/* Initialize one box containing whole space */
numboxes = 1;
@@ -1518,7 +1518,7 @@ init_error_limit (gdImagePtr im, my_cquantize_ptr cquantize)
my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
table = (int *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE * 2 + 1) * SIZEOF (int));
#else
- cquantize->error_limiter_storage = (int *) gdMalloc ((MAXJSAMPLE * 2 + 1) * sizeof (int));
+ cquantize->error_limiter_storage = (int *) safe_emalloc((MAXJSAMPLE * 2 + 1), sizeof(int), 0);
if (!cquantize->error_limiter_storage) {
return;
}
@@ -1719,9 +1719,9 @@ gdImageTrueColorToPalette (gdImagePtr im, int dither, int colorsWanted)
}
cquantize->needs_zeroed = TRUE; /* histogram is garbage now */
#else
- cquantize->histogram = (hist3d) gdMalloc (HIST_C0_ELEMS * sizeof (hist2d));
+ cquantize->histogram = (hist3d) safe_emalloc(HIST_C0_ELEMS, sizeof(hist2d), 0);
for (i = 0; i < HIST_C0_ELEMS; i++) {
- cquantize->histogram[i] = (hist2d) gdMalloc(HIST_C1_ELEMS * HIST_C2_ELEMS * sizeof (histcell));
+ cquantize->histogram[i] = (hist2d) safe_emalloc(HIST_C1_ELEMS, HIST_C2_ELEMS * sizeof(histcell), 0);
}
#endif
@@ -1891,7 +1891,7 @@ int gdImageColorMatch (gdImagePtr im1, gdImagePtr im2)
return -3; /* the images are meant to be the same dimensions */
}
- buf = (unsigned long *)gdMalloc( sizeof(unsigned long) * 5 * im2->colorsTotal );
+ buf = (unsigned long *)safe_emalloc(sizeof(unsigned long), 5 * im2->colorsTotal, 0);
memset( buf, 0, sizeof(unsigned long) * 5 * im2->colorsTotal );
for (x=0; x<im1->sx; x++) {
diff --git a/ext/gd/libgd/wbmp.c b/ext/gd/libgd/wbmp.c
index fad3566922..d63c684ac7 100644
--- a/ext/gd/libgd/wbmp.c
+++ b/ext/gd/libgd/wbmp.c
@@ -116,7 +116,7 @@ createwbmp (int width, int height, int color)
if ((wbmp = (Wbmp *) gdMalloc (sizeof (Wbmp))) == NULL)
return (NULL);
- if ((wbmp->bitmap = (int *) gdMalloc (sizeof (int) * width * height)) == NULL)
+ if ((wbmp->bitmap = (int *) safe_emalloc(sizeof(int), width * height, 0)) == NULL)
{
gdFree (wbmp);
return (NULL);