IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 30285


Ignore:
Timestamp:
Jan 17, 2011, 5:00:30 PM (15 years ago)
Author:
eugene
Message:

plug leaks (mostly unfreed pmFPAviews)

Location:
branches/eam_branches/ipp-20101205/ppSub/src
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20101205/ppSub/src/ppSub.c

    r29551 r30285  
    112112        psLibFinalize();
    113113
     114        fprintf (stderr, "found %d leaks at %s\n", psMemCheckLeaks (0, NULL, stdout, false), "ppSub");
    114115        exitValue = ppSubExitCode(exitValue);
    115116        exit(exitValue);
  • branches/eam_branches/ipp-20101205/ppSub/src/ppSubFiles.c

    r27094 r30285  
    125125    // FPA
    126126    if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
     127        psFree (view);
    127128        return false;
    128129    }
     
    131132    view->chip = 0;
    132133    if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
     134        psFree (view);
    133135        return false;
    134136    }
     
    137139    view->cell = 0;
    138140    if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
     141        psFree (view);
    139142        return false;
    140143    }
     
    143146    view->readout = 0;
    144147    if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
    145         return false;
    146     }
    147 
    148     ppSubFilesActivate(config, PPSUB_FILES_ALL, false);
    149 
     148        psFree (view);
     149        return false;
     150    }
     151
     152    ppSubFilesActivate(config, PPSUB_FILES_ALL, false);
     153
     154    psFree (view);
    150155    return true;
    151156}
     
    162167    // Readout
    163168    if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
     169        psFree (view);
    164170        return false;
    165171    }
     
    168174    view->readout = -1;
    169175    if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
     176        psFree (view);
    170177        return false;
    171178    }
     
    174181    view->cell = -1;
    175182    if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
     183        psFree (view);
    176184        return false;
    177185    }
     
    180188    view->chip = -1;
    181189    if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
     190        psFree (view);
    182191        return false;
    183192    }
     
    222231    ppSubFilesActivate(config, PPSUB_FILES_ALL, false);
    223232
     233    psFree (view);
    224234    return true;
    225235}
  • branches/eam_branches/ipp-20101205/ppSub/src/ppSubInputDetections.c

    r29937 r30285  
    118118        if (!psMetadataCopy(sourcesHDU->header, imageHDU->header)) {
    119119            psError(PPSUB_ERR_PROG, false, "Unable to copy header");
     120            psFree(view);
    120121            return false;
    121122        }
     
    130131    if (!psphotCopyResults (foundDetections, sourcesFile, photFile, view)) {
    131132        psError(PPSUB_ERR_PROG, false, "Unable to copy psphot outputs");
     133        psFree(view);
    132134        return false;
    133135    }
    134136    // if no sources were found here, we report that back and let them handle it
    135137
     138    psFree(view);
    136139    return true;
    137140}
  • branches/eam_branches/ipp-20101205/ppSub/src/ppSubLoop.c

    r30106 r30285  
    2626  pmReadout *out = pmFPAfileThisReadout(config->files, view, "PPSUB.OUTPUT");
    2727  psphotSaveImage (NULL, out->image, name);
     28  psFree(view);
    2829  return true;
    2930}
     
    111112        goto ESCAPE;
    112113    }
     114
    113115    if (data->quality) {
    114116        // Can't do anything at all
     
    257259        psError(psErrorCodeLast(), false, "Unable to generate mask statistics");
    258260        success = false;
     261        psFree(view);
    259262        goto ESCAPE;
    260263      }
     264      psFree(view);
    261265    }
    262266    // dumpout(config, "diff.4.fits");
  • branches/eam_branches/ipp-20101205/ppSub/src/ppSubMakePSF.c

    r29937 r30285  
    7979    if (!detections || !detections->allSources) {
    8080        psError(PPSUB_ERR_CONFIG, true, "No sources from which to determine PSF.");
     81        psFree(view);
    8182        return false;
    8283    }
  • branches/eam_branches/ipp-20101205/ppSub/src/ppSubMatchPSFs.c

    r29937 r30285  
    7878        return true;
    7979    }
    80 
    8180    psFree(view);
    8281
     
    127126    if (!inSourceRO || !refSourceRO) {
    128127        psError(PPSUB_ERR_DATA, false, "Unable to scale kernel, since no sources were provided.");
     128        psFree(view);
    129129        return false;
    130130    }
     
    166166    if (!psMetadataLookupBool(NULL, recipe, "SCALE")) {
    167167        // No scaling requested
    168         psFree(view);
    169168        return true;
    170169    }
     
    221220        pmCell *cell = pmFPAfileThisCell(config->files, view, "PPSUB.INPUT.CONV"); // Cell for convolved input
    222221        inConv = pmReadoutAlloc(cell);
     222        psFree(inConv);
    223223    }
    224224    pmReadout *refConv = pmFPAfileThisReadout(config->files, view, "PPSUB.REF.CONV"); // Reference convolved
     
    226226        pmCell *cell = pmFPAfileThisCell(config->files, view, "PPSUB.REF.CONV"); // Cell for convolved ref.
    227227        refConv = pmReadoutAlloc(cell);
     228        psFree(refConv);
    228229    }
    229230
  • branches/eam_branches/ipp-20101205/ppSub/src/ppSubReadoutForcedPhot.c

    r29937 r30285  
    6161        // XXX remove the pixels from photFile?
    6262        // XXX other cleanup operations?
     63        psFree(view);
    6364        return true;
    6465    }
     
    8990    if (!psphotCopyResults (&foundDetections, outputFile, photFile, view)) {
    9091        psError(PPSUB_ERR_PROG, false, "Unable to copy psphot outputs");
     92        psFree(view);
    9193        return false;
    9294    }
     
    9799    psMetadataAddF32(data->stats, PS_LIST_TAIL, "TIME_PHOT", PS_META_REPLACE, "Time to do photometry", elapsed);
    98100
     101    psFree(view);
    99102    return true;
    100103}
  • branches/eam_branches/ipp-20101205/ppSub/src/ppSubReadoutInverse.c

    r27789 r30285  
    3636    if (!pmAstromWriteWCS(invHDU->header, outFPA, outChip, WCS_TOLERANCE)) {
    3737        psError(psErrorCodeLast(), false, "Unable to write WCS astrometry to PPSUB.INVERSE.");
     38        psFree(view);
    3839        return false;
    3940    }
     
    4142    if (!pmAstromReadWCS(invFPA, invChip, invHDU->header, 1.0)) {
    4243        psError(psErrorCodeLast(), false, "Unable to read WCS astrometry.");
     44        psFree(view);
    4345        return false;
    4446    }
    4547
     48    psFree(view);
    4649    return true;
    4750}
  • branches/eam_branches/ipp-20101205/ppSub/src/ppSubReadoutJpeg.c

    r26982 r30285  
    139139    }
    140140
     141    psFree(view);
    141142    return true;
    142143}
  • branches/eam_branches/ipp-20101205/ppSub/src/ppSubReadoutPhotometry.c

    r29937 r30285  
    109109        if (!psMetadataCopySingle(inRO->analysis, photRO->analysis, "PSPHOT.DETECTIONS")) {
    110110            psError(PPSUB_ERR_PROG, false, "Unable to copy PSPHOT.DETECTIONS");
     111            psFree(view);
    111112            return false;
    112113        }
    113114        if (!psMetadataCopySingle(inRO->analysis, photRO->analysis, "PSPHOT.HEADER")) {
    114115            psError(PPSUB_ERR_PROG, false, "Unable to copy PSPHOT.HEADER");
     116            psFree(view);
    115117            return false;
    116118        }
    117119        if (!psMetadataCopySingle(inRO->analysis, photRO->analysis, PM_DETEFF_ANALYSIS)) {
    118120            psError(PPSUB_ERR_PROG, false, "Unable to copy Detection Efficiency");
     121            psFree(view);
    119122            return false;
    120123        }
     
    128131    }
    129132
     133    psFree(view);
    130134    return true;
    131135}
    132136
    133137#ifdef TESTING
    134     // Record data about sources: not everything gets into the output CMF files
     138// Record data about sources: not everything gets into the output CMF files
    135139    {
    136140        pmReadout *photRO = pmFPAviewThisReadout(view, photFile->fpa); // Readout with the sources
  • branches/eam_branches/ipp-20101205/ppSub/src/ppSubReadoutSubtract.c

    r29003 r30285  
    109109    pmChip *outChip = pmFPAfileThisChip(config->files, view, "PPSUB.OUTPUT"); // Output chip
    110110    psFree(view);
     111
    111112    if (!outHDU || !inHDU) {
    112113        psError(PPSUB_ERR_PROG, true, "Unable to find HDU at FPA level to copy astrometry.");
  • branches/eam_branches/ipp-20101205/ppSub/src/ppSubSetMasks.c

    r29551 r30285  
    8080    if (!pmReadoutMaskInvalid(inRO, maskValue, satValue)) {
    8181        psError(PPSUB_ERR_DATA, false, "Unable to mask non-finite pixels in input.");
     82        psFree(view);
    8283        return false;
    8384    }
    8485    if (!pmReadoutMaskInvalid(refRO, maskValue, satValue)) {
    8586        psError(PPSUB_ERR_DATA, false, "Unable to mask non-finite pixels in reference.");
     87        psFree(view);
    8688        return false;
    8789    }
     
    9496    if (interpMode == PS_INTERPOLATE_NONE) {
    9597        psError(PPSUB_ERR_CONFIG, false, "Unknown interpolation mode: %s", interpModeStr);
     98        psFree(view);
    9699        return false;
    97100    }
     
    104107    if (!pmReadoutInterpolateBadPixels(inRO, maskVal, interpMode, poorFrac, maskPoor, maskBad)) {
    105108        psError(PPSUB_ERR_DATA, false, "Unable to interpolate bad pixels for input image.");
     109        psFree(view);
    106110        return false;
    107111    }
    108112    if (!pmReadoutInterpolateBadPixels(refRO, maskVal, interpMode, poorFrac, maskPoor, maskBad)) {
    109113        psError(PPSUB_ERR_DATA, false, "Unable to interpolate bad pixels for reference image.");
     114        psFree(view);
    110115        return false;
    111116    }
     
    113118#endif
    114119
     120    psFree(view);
    115121    return true;
    116122}
  • branches/eam_branches/ipp-20101205/ppSub/src/ppSubThreshold.c

    r26982 r30285  
    9898    if (!in) {
    9999        psError(PPSUB_ERR_UNKNOWN, false, "Unable to find readout.");
     100        psFree(view);
    100101        return false;
    101102    }
     
    104105    if (!ref) {
    105106        psError(PPSUB_ERR_UNKNOWN, false, "Unable to find readout.");
     107        psFree(view);
    106108        return false;
    107109    }
     
    115117        if (!lowThreshold(in, thresh, maskVal, maskThresh, region, "input convolved image")) {
    116118            psError(psErrorCodeLast(), false, "Unable to threshold input image.");
     119            psFree(view);
    117120            return false;
    118121        }
    119122        if (!lowThreshold(ref, thresh, maskVal, maskThresh, region, "reference convolved image")) {
    120123            psError(psErrorCodeLast(), false, "Unable to threshold input image.");
     124            psFree(view);
    121125            return false;
    122126        }
  • branches/eam_branches/ipp-20101205/ppSub/src/ppSubVarianceRescale.c

    r28121 r30285  
    5757        // Nothing to renormalise
    5858        psWarning("Renormalisation of the variance requested, but no variance provided.");
     59        psFree(view);
    5960        return true;
    6061    }
     
    6970    }
    7071
     72    psFree(view);
    7173    return true;
    7274}
Note: See TracChangeset for help on using the changeset viewer.