IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6386


Ignore:
Timestamp:
Feb 8, 2006, 1:02:02 PM (20 years ago)
Author:
Paul Price
Message:

Fixing memory leaks and multiple frees

Location:
branches/eam_rel9_p0/psModules/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_rel9_p0/psModules/src/astrom/pmChipMosaic.c

    r6351 r6386  
    288288    int nCells = cells->n;
    289289
    290     // Modify the "original" pixels
     290    // Fix up the HDU
    291291    if (chip->parent->hdu) {
    292292        psLogMsg(__func__, PS_LOG_WARN, "The original format has the entire FPA in a single extension.  "
     
    311311    }
    312312
    313     // Chop off all the component cells, and put in a new one
     313    // Chop off all the component cells, and construct a new one
    314314    pmCell *newCell = pmCellAlloc(NULL, NULL, __func__); // New cell
    315315    cellConcepts(newCell, cells, xBinChip, yBinChip);
     
    326326    // This preserves the relationship there was before, where freeing the parent frees the child.
    327327    psRegion entire = {0.0, 0.0, 0.0, 0.0};
    328     newReadout->image = psImageSubset(image, entire);
    329     newReadout->weight = psImageSubset(weight, entire);
    330     newReadout->mask = psImageSubset(mask, entire);
     328    newReadout->image = psMemIncrRefCounter(psImageSubset(image, entire));
     329    newReadout->weight = psMemIncrRefCounter(psImageSubset(weight, entire));
     330    newReadout->mask = psMemIncrRefCounter(psImageSubset(mask, entire));
    331331    // Drop references
    332332    psFree(newReadout);
  • branches/eam_rel9_p0/psModules/src/astrom/pmFPA.c

    r6358 r6386  
    1212* XXX: Should we implement non-linear cell->chip transforms?
    1313*
    14 *  @version $Revision: 1.1.2.8 $ $Name: not supported by cvs2svn $
    15 *  @date $Date: 2006-02-08 01:16:11 $
     14*  @version $Revision: 1.1.2.9 $ $Name: not supported by cvs2svn $
     15*  @date $Date: 2006-02-08 23:02:02 $
    1616*
    1717*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    182182    for (psS32 i = 0 ; i < readouts->n ; i++) {
    183183        pmReadout *tmpReadout = readouts->data[i];
     184        if (! tmpReadout) {
     185            continue;
     186        }
    184187        readouts->data[i] = NULL;
    185188        tmpReadout->parent = NULL;
     
    206209    for (int i = 0 ; i < cells->n ; i++) {
    207210        pmCell *tmpCell = cells->data[i];
     211        if (! tmpCell) {
     212            continue;
     213        }
    208214        cells->data[i] = NULL;
    209215        tmpCell->parent = NULL;
  • branches/eam_rel9_p0/psModules/src/astrom/pmFPARead.c

    r6145 r6386  
    121121        psRegion *biassec = NULL;       // A BIASSEC region from the list
    122122        while ((biassec = psListGetAndIncrement(iter))) {
    123             psImage *overscan = psImageSubset(image, *biassec);
     123            psImage *overscan = psMemIncrRefCounter(psImageSubset(image, *biassec));
    124124            psListAdd(readout->bias, PS_LIST_TAIL, overscan);
    125125            psFree(overscan);
  • branches/eam_rel9_p0/psModules/src/astrom/pmReadout.c

    r6062 r6386  
    1717    psRegion *region = NULL;            // Bias region from list
    1818    while ((region = psListGetAndIncrement(sectionsIter))) {
    19         psImage *bias = psImageSubset(image, *region); // Image from bias section
     19        psImage *bias = psMemIncrRefCounter(psImageSubset(image, *region)); // Image from bias section
    2020        psListAdd(images, PS_LIST_TAIL, bias);
    2121        psFree(bias);
  • branches/eam_rel9_p0/psModules/src/imsubtract/pmSubtractBias.c

    r6352 r6386  
    1111 *  @author GLG, MHPCC
    1212 *
    13  *  @version $Revision: 1.6.8.1.2.6 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2006-02-08 00:53:55 $
     13 *  @version $Revision: 1.6.8.1.2.7 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2006-02-08 23:02:02 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    572572        }
    573573        psFree(myStats);
    574         psFree(overscans);
    575574    } // End of overscan subtraction
    576575
Note: See TracChangeset for help on using the changeset viewer.