Changeset 454 for trunk/src/sh_mem.c


Ignore:
Timestamp:
Jun 29, 2014, 7:30:04 AM (10 years ago)
Author:
katerina
Message:

Fix for ticket #355 (use calloc instead of malloc).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sh_mem.c

    r292 r454  
    142142  while (this != NULL)
    143143    {
    144       memlist_t   * merr = (memlist_t *) malloc (sizeof(memlist_t));
     144      memlist_t   * merr = calloc(1,sizeof(memlist_t));
    145145
    146146      memcpy(merr, this, sizeof(memlist_t));
     
    191191      if ( this->address == NULL )
    192192        {
    193           merr = (memlist_t *) malloc (sizeof(memlist_t));
     193          merr = calloc (1,sizeof(memlist_t));
    194194
    195195          memcpy(merr, this, sizeof(memlist_t));
     
    204204          if ( this->address[this->size]        != CHECKBYTE )
    205205            {
    206               merr = (memlist_t *) malloc (sizeof(memlist_t));
     206              merr = calloc(1, sizeof(memlist_t));
    207207             
    208208              memcpy(merr, this, sizeof(memlist_t));
     
    215215          if ( this->real_address[SH_MEMMULT-1] != CHECKBYTE )
    216216            {
    217               merr = (memlist_t *) malloc (sizeof(memlist_t));
     217              merr = calloc(1, sizeof(memlist_t));
    218218             
    219219              memcpy(merr, this, sizeof(memlist_t));
     
    262262  SH_MUTEX_RECURSIVE_LOCK(mutex_mem);
    263263
    264   the_realAddress = malloc(size + 2 * SH_MEMMULT);
     264  the_realAddress = calloc(1,size + 2 * SH_MEMMULT);
    265265 
    266266  if ( the_realAddress  == NULL )
     
    290290  Mem_Max = ( (Mem_Current > Mem_Max) ? Mem_Current : Mem_Max);
    291291
    292   this = (memlist_t *) malloc (sizeof(memlist_t));
     292  this = calloc(1,sizeof(memlist_t));
    293293
    294294  if ( this == NULL)
     
    370370      if ( this->address[this->size]        != CHECKBYTE )
    371371        {
    372           merr = (memlist_t *) malloc (sizeof(memlist_t));
     372          merr = calloc(1, sizeof(memlist_t));
    373373
    374374          memcpy(merr, this, sizeof(memlist_t));
     
    381381      if ( this->real_address[SH_MEMMULT-1] != CHECKBYTE )
    382382        {
    383           merr = (memlist_t *) malloc (sizeof(memlist_t));
     383          merr = calloc(1,sizeof(memlist_t));
    384384
    385385          memcpy(merr, this, sizeof(memlist_t));
     
    454454  SL_ENTER(_("sh_mem_malloc"));
    455455
    456   theAddress = malloc(size);
     456  theAddress = calloc(1,size);
    457457
    458458  if ( theAddress != NULL )
Note: See TracChangeset for help on using the changeset viewer.