IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 7, 2006, 8:52:03 PM (20 years ago)
Author:
eugene
Message:

extensive cleanup of memory handling : no more leaks!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/pmSourceFitSet.c

    r5993 r6379  
    105105    for (psS32 i = 0; i < source->pixels->numRows; i++) {
    106106        for (psS32 j = 0; j < source->pixels->numCols; j++) {
     107            // skip masked points
    107108            if (source->mask->data.U8[i][j]) {
    108109                continue;
    109110            }
     111            // skip zero-weight points
     112            if (source->weight->data.F32[i][j] == 0) {
     113                continue;
     114            }
    110115            psVector *coord = psVectorAlloc(2, PS_TYPE_F32);
    111116
     
    115120            x->data[nPix] = (psPtr *) coord;
    116121            y->data.F32[nPix] = source->pixels->data.F32[i][j];
    117 
    118122            // psMinimizeLMChi2 takes wt = 1/dY^2
    119             if (source->weight->data.F32[i][j] == 0) {
    120                 continue;
    121             }
    122123            yErr->data.F32[nPix] = 1.0 / source->weight->data.F32[i][j];
    123124            nPix++;
     
    131132        psFree (y);
    132133        psFree (yErr);
     134        psFree (params);
     135        psFree (dparams);
     136        psFree (paramMask);
    133137        return(false);
    134138    }
     
    180184            dparams->data.F32[i] = delta->data.F64[i];
    181185        }
     186        psFree (delta);
    182187    }
    183188
     
    217222    psFree(covar);
    218223    psFree(paramMask);
     224    psFree(params);
     225    psFree(dparams);
     226    psFree(params_min);
     227    psFree(params_max);
     228    psFree(beta_lim);
     229
     230    // free static memory used by pmModelFitSet
     231    pmModelFitSetClear ();
    219232
    220233    rc = (onPic && fitStatus);
Note: See TracChangeset for help on using the changeset viewer.