IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13675


Ignore:
Timestamp:
Jun 5, 2007, 6:31:38 PM (19 years ago)
Author:
eugene
Message:

fixing double frees, leaks

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppImage/src/ppImageLoop.c

    r13667 r13675  
    1010bool ppImageLoop (pmConfig *config, ppImageOptions *options) {
    1111
     12    bool mdok;                      // Status of MD lookup
    1213    bool status;
    1314    pmChip *chip;
    1415    pmCell *cell;
    1516    pmReadout *readout;
    16 
    17     bool mdok;                      // Status of MD lookup
     17    psMetadata *stats = NULL;
     18
    1819    const char *statsName = psMetadataLookupStr(&mdok, config->arguments, "STATS"); // Filename for statistics
    19     psMetadata *stats = NULL;           // Container for statistics
    2020    FILE *statsFile = NULL;             // File stream for statistics
    2121    if (mdok && statsName && strlen(statsName) > 0) {
     
    2727            return false;
    2828        } else {
    29             stats = psMetadataAlloc();
     29            stats = psMetadataAlloc();
    3030        }
    3131        psFree(resolved);
     
    123123                    return false;
    124124                }
    125                 ppStats(stats, output->fpa, view,
    126                         options->satMask | options->badMask | options->maskValue,
    127                         config);
     125                psMetadata *newStats = ppStats(output->fpa, view,
     126                                               options->satMask | options->badMask | options->maskValue,
     127                                               config);
     128                if (!newStats) {
     129                    psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to generate stats for image.\n");
     130                    return false;
     131                }
     132                psMetadataCopy (stats, newStats);
     133                psFree (newStats);
    128134            }
    129135
     
    200206        psFree((void *)statsMDC);
    201207        fclose(statsFile);
    202 
    203208        psFree(stats);
    204209    }
  • trunk/ppStats/src/ppStats.c

    r13658 r13675  
    99#include "ppStats.h"
    1010
    11 psMetadata *ppStats(psMetadata *out,    // Output metadata
    12                     pmFPA *fpa,         // FPA for which to get statistics
     11psMetadata *ppStats(pmFPA *fpa,         // FPA for which to get statistics
    1312                    pmFPAview *view,    // View for analysis
    1413                    psMaskType maskVal, // Value to mask
     
    4645    // Go through the FPA and do the hard work
    4746    psExit status;                      // Status of statistics loop
    48     psMetadata *result = ppStatsLoop(&status, out, data, config);
     47    psMetadata *result = ppStatsLoop(&status, data, config);
    4948    if (status != PS_EXIT_SUCCESS) {
    5049        psError (PS_ERR_UNKNOWN, false, "Not able to measure FPA statistics.\n");
  • trunk/ppStats/src/ppStats.h

    r13658 r13675  
    1212
    1313// Perform the ppStats steps
    14 psMetadata *ppStats(psMetadata *out,    // Output metadata
    15                     pmFPA *fpa,         // FPA for which to get statistics
     14psMetadata *ppStats(pmFPA *fpa,         // FPA for which to get statistics
    1615                    pmFPAview *view,    // View for analysis
    1716                    psMaskType maskVal, // Value to mask
  • trunk/ppStats/src/ppStatsLoop.c

    r13657 r13675  
    353353
    354354psMetadata *ppStatsLoop(psExit *result,
    355                         psMetadata *fpaResults, // Metadata to hold the FPA results
    356355                        ppStatsData *data, // The data
    357356                        const pmConfig *config // Configuration
     
    369368
    370369    // allocate a new one if needed
    371     psMetadata *newResults = fpaResults;
    372     if (!newResults) {
    373         newResults = psMetadataAlloc();
    374     }
     370    psMetadata *newResults = psMetadataAlloc();
    375371
    376372    // Iterate through the FPA
  • trunk/ppStats/src/ppStatsLoop.h

    r13640 r13675  
    77// Loop over the input image and do all the hard work
    88psMetadata *ppStatsLoop(psExit *result,
    9                         psMetadata *fpaResults, // Metadata to hold the FPA results
    109                        ppStatsData *data, // The data
    1110                        const pmConfig *config // Configuration
  • trunk/ppStats/src/ppStatsStandAlone.c

    r13658 r13675  
    5858
    5959    // Go through the FPA and do the hard work
    60     psMetadata *results = ppStatsLoop(&status, NULL, data, config);
     60    psMetadata *results = ppStatsLoop(&status, data, config);
    6161    if (status != PS_EXIT_SUCCESS) {
    6262        psErrorStackPrint(stderr, "Error in stats loop.\n");
Note: See TracChangeset for help on using the changeset viewer.