IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 5, 2007, 1:42:46 PM (19 years ago)
Author:
Paul Price
Message:

Propagating allocation information, so leaks can be tracked down easier.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/mathtypes/psImage.c

    r14921 r15454  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.130 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2007-09-20 23:48:30 $
     11 *  @version $Revision: 1.131 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2007-11-05 23:42:46 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    4444    // if I am a child, remove me from my parent's array of children
    4545    if (parent != NULL) {
    46         // sanity check : a child cannot also be a parent
    47         if ((image->children != NULL) && (image->children->n > 0)) {
    48             psAbort ("psImage cannot be both child and parent!");
    49         }
    50 
    51         // break the back-pointer first so we don't loop
    52         image->parent = NULL; 
    53 
    54         // drop my entry on my parent's array of children
    55         psArrayRemoveDataNoFree (parent->children, image);
    56        
    57         // drop my reference to my parent
    58         psFree (parent);
    59     }
    60    
     46        // sanity check : a child cannot also be a parent
     47        if ((image->children != NULL) && (image->children->n > 0)) {
     48            psAbort ("psImage cannot be both child and parent!");
     49        }
     50
     51        // break the back-pointer first so we don't loop
     52        image->parent = NULL;
     53
     54        // drop my entry on my parent's array of children
     55        psArrayRemoveDataNoFree (parent->children, image);
     56
     57        // drop my reference to my parent
     58        psFree (parent);
     59    }
     60
    6161    // sanity check: this function should never be reached if an image still has live children;
    6262    // they should each be holding a pointer to the image, forcing the number of references to
    6363    // be > 1.
    6464    if (image->children && (image->children->n > 0)) {
    65         psAbort ("psImage memory management programming error : imageFree called on image with live children");
     65        psAbort ("psImage memory management programming error : imageFree called on image with live children");
    6666    }
    6767
     
    100100    psMemSetDeallocator(image, (psFreeFunc) imageFree);
    101101
    102     image->data.V = psAlloc(sizeof(psPtr ) * numRows);
    103 
    104     image->p_rawDataBuffer = psAlloc(numBytes);
     102    image->data.V = p_psAlloc(file, lineno, func, sizeof(psPtr ) * numRows);
     103
     104    image->p_rawDataBuffer = p_psAlloc(file, lineno, func, numBytes);
    105105
    106106    // set the row pointers.
Note: See TracChangeset for help on using the changeset viewer.