IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 30, 2007, 12:12:12 PM (19 years ago)
Author:
Paul Price
Message:

Putting pointer declarations early, since in the event of an error
they are all freed after a "goto". That means that they all need to
be declared before the first "goto".

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/imcombine/pmSubtractionMatch.c

    r14701 r14713  
    212212    }
    213213
     214    // Putting important variable declarations here, since they are freed after a "goto" if there is an error.
     215    psImage *subMask = NULL;            // Mask for subtraction
     216    psArray *stamps = NULL;             // Stamps for matching PSF
     217    psRegion *region = NULL;            // Iso-kernel region
     218    psString regionString = NULL;       // String for region
     219    psVector *solution = NULL;          // Solution to match PSF
     220    pmSubtractionKernels *kernels = NULL; // Kernel basis functions
     221
    214222    // Read stamps from file
    215223    psArray *stampsData = NULL;         // Stamps data read from file
     
    240248    memCheck("start");
    241249
    242     // Mask for subtraction
    243     psImage *subMask = pmSubtractionMask(reference->mask, inMask, maskBad, size, footprint);
     250    subMask = pmSubtractionMask(reference->mask, inMask, maskBad, size, footprint);
    244251
    245252    memCheck("mask");
    246253
    247 
    248     psArray *stamps = NULL;             // Stamps for matching PSF
    249 
    250     pmSubtractionKernels *kernels = NULL; // Kernel basis functions
    251254    if (optimum && (type == PM_SUBTRACTION_KERNEL_ISIS || type == PM_SUBTRACTION_KERNEL_GUNK)) {
    252255        if (!getStamps(&stamps, stampsData, reference, input, subMask, weight, NULL,
     
    277280    psMetadataAddPtr(convolved->analysis, PS_LIST_TAIL, "SUBTRACTION.KERNEL", PS_DATA_UNKNOWN,
    278281                     "Subtraction kernels", kernels);
    279     psVector *solution = NULL;          // Solution to match PSF
    280 
    281282
    282283    memCheck("kernels");
    283284
     285    // Get region of interest
    284286    int xRegions = 1, yRegions = 1;     // Number of iso-kernel regions
    285287    float xRegionSize = 0, yRegionSize = 0; // Size of iso-kernel regions
    286     psRegion *region = NULL;            // Iso-kernel region
    287     psString regionString = NULL;       // String for region
    288288    if (isfinite(regionSize) && regionSize != 0.0) {
    289289        xRegions = numCols / regionSize + 1;
     
    481481    psFree(solution);
    482482    psFree(stampsData);
     483    psFree(stamps);
    483484    return false;
    484485}
Note: See TracChangeset for help on using the changeset viewer.