diff --git a/src/modules/Image/encodings/psd.c b/src/modules/Image/encodings/psd.c index fc3db9f6284fe79b74bd89850b3d259b47386832..731bb2549cccd8300d5e44a366b045a333fa591f 100644 --- a/src/modules/Image/encodings/psd.c +++ b/src/modules/Image/encodings/psd.c @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: psd.c,v 1.47 2008/01/19 15:28:27 grubba Exp $ +|| $Id: psd.c,v 1.48 2010/10/01 14:12:10 nilsson Exp $ */ #include "global.h" @@ -213,9 +213,8 @@ static void decode_layers_and_masks( struct psd_image *dst, while( count-- ) { unsigned int cnt; - struct layer *l= - layer = (struct layer *)xalloc( sizeof( struct layer )); - MEMSET(layer, 0, sizeof(struct layer)); + struct layer *l= + layer = (struct layer *)xcalloc( sizeof( struct layer ), 1); layer->next = dst->first_layer; if(dst->first_layer) dst->first_layer->prev = layer; dst->first_layer = layer; diff --git a/src/modules/Image/encodings/tga.c b/src/modules/Image/encodings/tga.c index e343c01dc6a72f1d7faf712799bec57397d97b08..ad76fc48476300f62f80b866d94572314190fcee 100644 --- a/src/modules/Image/encodings/tga.c +++ b/src/modules/Image/encodings/tga.c @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: tga.c,v 1.42 2008/01/27 20:28:41 grubba Exp $ +|| $Id: tga.c,v 1.43 2010/10/01 14:12:10 nilsson Exp $ */ /* @@ -570,10 +570,7 @@ static struct image_alpha ReadImage(struct buffer *fp, struct tga_header *hdr) pelbytes = ROUNDUP_DIVIDE (hdr->colorMapSize, 8); colors = length + index; - cmap = malloc (colors * pelbytes); - - /* Zero the entries up to the beginning of the map. */ - MEMSET (cmap, 0, index * pelbytes); + cmap = xcalloc (colors * pelbytes, 1); /* Read in the rest of the colormap. */ if (std_fread (cmap + (index * pelbytes), pelbytes, length, fp) != length)