IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 14803


Ignore:
Timestamp:
Sep 10, 2007, 11:41:41 AM (19 years ago)
Author:
Paul Price
Message:

Fixing memory leak.

File:
1 edited

Legend:

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

    r14802 r14803  
    234234            if (stampsName && strlen(stampsName) > 0) {
    235235                psTrace("psModules.imcombine", 3, "Reading stamps from %s...\n", stampsName);
     236                const char *stampFormat = input ? "%f %f" : "%f %f %f"; // Format for reading stamp file
     237                psArray *stampsData = stampsData = psVectorsReadFromFile(stampsName, stampFormat);
    236238                psVector *xStamp = NULL, *yStamp = NULL, *fluxStamp = NULL; // Stamp positions and fluxes
    237                 if (input) {
    238                     // We have x, y because the target is provided by the input image
    239                     psArray *stampsData = psVectorsReadFromFile(stampsName, "%f %f"); // Stamp positions
    240                     if (!stampsData) {
    241                         psError(PS_ERR_IO, false, "Unable to read stamps file %s", stampsName);
    242                         goto ERROR;
    243                     }
    244                     xStamp = psMemIncrRefCounter(stampsData->data[0]);
    245                     yStamp = psMemIncrRefCounter(stampsData->data[1]);
    246                     psFree(stampsData);
    247                 } else {
    248                     // We have x, y and flux in order to generate a target
    249                     psArray *stampsData = psVectorsReadFromFile(stampsName, "%f %f %f"); // Stamp positions
    250                     if (!stampsData) {
    251                         psError(PS_ERR_IO, false, "Unable to read stamps file %s", stampsName);
    252                         goto ERROR;
    253                     }
    254                     xStamp = psMemIncrRefCounter(stampsData->data[0]);
    255                     yStamp = psMemIncrRefCounter(stampsData->data[1]);
    256                     fluxStamp = psMemIncrRefCounter(stampsData->data[2]);
    257                     psFree(stampsData);
     239                if (!stampsData) {
     240                    psError(PS_ERR_IO, false, "Unable to read stamps file %s", stampsName);
     241                    goto ERROR;
     242                }
     243                xStamp = stampsData->data[0];
     244                yStamp = stampsData->data[1];
     245                if (!input) {
     246                    fluxStamp = stampsData->data[2];
    258247                }
    259248
     
    264253                stamps = pmSubtractionStampsSet(xStamp, yStamp, fluxStamp, reference->image, subMask,
    265254                                                region, stampSpacing, input ? 0 : 2 * footprint);
     255                psFree(stampsData);
    266256            }
    267257
Note: See TracChangeset for help on using the changeset viewer.