Changeset 12460 for trunk/FACT++


Ignore:
Timestamp:
11/09/11 01:12:50 (13 years ago)
Author:
lyard
Message:
added double check before releasing memory
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/EventBuilder.c

    r12459 r12460  
    232232    while (EtiMemoryChunks[chunkIndex].nFreeSlots == EtiMemoryChunks[chunkIndex].nSlots)
    233233    {//free this chunk
     234        if (EtiMemoryChunks[chunkIndex].pointers[0] == NULL)
     235        {
     236            factOut(kError, "Chunk %d not allocated as it ought to be. Skipping release", chunkIndex);
     237            return;
     238        }
    234239        free(EtiMemoryChunks[chunkIndex].pointers[0]);
     240        EtiMemoryChunks[chunkIndex].pointers[0] = NULL;
    235241        numAllocatedChunks--;
    236242        chunkIndex--;
     
    463469      mBufferMapping[i].eventNumber = -1;
    464470      mBufferMapping[i].slot = -1;
     471      for (i=0;i<MAX_CHUNKS;i++)
     472          EtiMemoryChunks[i].pointers[0] = NULL;
    465473      //END ETIENNE
    466474   }
Note: See TracChangeset for help on using the changeset viewer.