From: Nuno Lopes Date: Sun, 17 Jun 2007 19:03:58 +0000 (+0000) Subject: malloc+memset == calloc (sync with libgd) X-Git-Tag: php-5.2.4RC1~334 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=74474a1ef89efcf841868c5e0fba6322dad1646b;p=php malloc+memset == calloc (sync with libgd) --- diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c index 9119a00b08..301072f4e7 100644 --- a/ext/gd/libgd/gd.c +++ b/ext/gd/libgd/gd.c @@ -129,8 +129,8 @@ gdImagePtr gdImageCreate (int sx, int sy) return NULL; } - im = (gdImage *) gdMalloc(sizeof(gdImage)); - memset(im, 0, sizeof(gdImage)); + im = (gdImage *) gdCalloc(1, sizeof(gdImage)); + /* Row-major ever since gd 1.3 */ im->pixels = (unsigned char **) gdMalloc(sizeof(unsigned char *) * sy); im->AA_opacity = (unsigned char **) gdMalloc(sizeof(unsigned char *) * sy);