iliaa           Tue Dec 30 20:01:45 2003 EDT

  Modified files:              
    /php-src/ext/gd/libgd       gd_topal.c wbmp.c 
  Log:
  Replace regular malloc with safe_emalloc in several places.
  
  
Index: php-src/ext/gd/libgd/gd_topal.c
diff -u php-src/ext/gd/libgd/gd_topal.c:1.13 php-src/ext/gd/libgd/gd_topal.c:1.14
--- php-src/ext/gd/libgd/gd_topal.c:1.13        Sun Dec 28 15:11:08 2003
+++ php-src/ext/gd/libgd/gd_topal.c     Tue Dec 30 20:01:44 2003
@@ -765,7 +765,7 @@
 #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 @@
        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 @@
        }
        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 @@
                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++) {
Index: php-src/ext/gd/libgd/wbmp.c
diff -u php-src/ext/gd/libgd/wbmp.c:1.4 php-src/ext/gd/libgd/wbmp.c:1.5
--- php-src/ext/gd/libgd/wbmp.c:1.4     Sun Dec 28 15:11:08 2003
+++ php-src/ext/gd/libgd/wbmp.c Tue Dec 30 20:01:44 2003
@@ -116,7 +116,7 @@
   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);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to