rv = GetDataBlock_(fd,buf);
if (VERBOSE) {
if (rv > 0) {
- tmp = emalloc((3*sizeof(char)*rv) + 1);
+ tmp = safe_emalloc(3 * rv, sizeof(char), 1);
for (i=0;i<rv;i++) {
sprintf(&tmp[3*sizeof(char)*i], " %02x", buf[i]);
}
/* allocate space for the PNG image data */
rowbytes = png_get_rowbytes(png_ptr, info_ptr);
- image_data = (png_bytep) gdMalloc (rowbytes * height);
+ image_data = (png_bytep) safe_emalloc(rowbytes, height, 0);
- row_pointers = (png_bytepp) gdMalloc (height * sizeof (png_bytep));
+ row_pointers = (png_bytepp) safe_emalloc(height, sizeof(png_bytep), 0);
/* set the individual row_pointers to point at the correct offsets */
for (h = 0; h < height; ++h) {
int channels = im->saveAlphaFlag ? 4 : 3;
/* Our little 7-bit alpha channel trick costs us a bit here. */
png_bytep *row_pointers;
- row_pointers = gdMalloc(sizeof (png_bytep) * height);
+ row_pointers = safe_emalloc(sizeof(png_bytep), height, 0);
for (j = 0; j < height; ++j) {
int bo = 0;
- row_pointers[j] = (png_bytep) gdMalloc(width * channels);
+ row_pointers[j] = (png_bytep) safe_emalloc(width, channels, 0);
for (i = 0; i < width; ++i) {
unsigned char a;
row_pointers[j][bo++] = gdTrueColorGetRed(im->tpixels[j][i]);
} else {
if (remap) {
png_bytep *row_pointers;
- row_pointers = gdMalloc(sizeof (png_bytep) * height);
+ row_pointers = safe_emalloc(height, sizeof(png_bytep), 0);
for (j = 0; j < height; ++j) {
row_pointers[j] = (png_bytep) gdMalloc(width);
for (i = 0; i < width; ++i) {
}
number = image.ncolors;
- colors = (int *) gdMalloc (sizeof (int) * number);
+ colors = (int *) safe_emalloc(number, sizeof(int), 0);
for (i = 0; i < number; i++) {
switch (strlen (image.colorTable[i].c_color)) {
case 4:
printf ("W: %d, H: %d\n", wbmp->width, wbmp->height);
#endif
- if ((wbmp->bitmap = (int *) gdMalloc (sizeof (int) * wbmp->width * wbmp->height)) == NULL)
+ if ((wbmp->bitmap = (int *) safe_emalloc(wbmp->width * wbmp->height, sizeof(int), 0)) == NULL)
{
gdFree (wbmp);
return (-1);