IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 7, 2006, 12:55:47 PM (20 years ago)
Author:
rhl
Message:

1/ Always call psError(..., true, ...) or psErrorClear() when detecting
a new error
2/ Fix a memory leak with headerItem

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/concepts/pmConceptsRead.c

    r7311 r7410  
    6262
    6363    if (!concept) {
     64        psError(PS_ERR_UNKNOWN, true, "Concept is NULL");
    6465        return false;
    6566    }
     
    115116    PS_ASSERT_PTR_NON_NULL(target, false);
    116117    if (!cell) {
     118        psError(PS_ERR_UNKNOWN, true, "cell is NULL");
    117119        return false;
    118120    }
     
    120122    pmHDU *hdu = pmHDUGetLowest(NULL, NULL, cell); // The HDU at the lowest level
    121123    if (!hdu) {
     124        psError(PS_ERR_UNKNOWN, true, "Can't find HDU for cell");
    122125        return false;
    123126    }
     
    178181    pmHDU *hdu = pmHDUGetLowest(fpa, chip, cell); // The HDU at the lowest level
    179182    if (!hdu) {
     183        psError(PS_ERR_UNKNOWN, true, "Can't find HDU for cell");
    180184        return false;
    181185    }
     
    184188    psMetadata *defaults = psMetadataLookupMD(&mdok, cameraFormat, "DEFAULTS"); // The DEFAULTS spec
    185189    if (!mdok || !defaults) {
     190        psError(PS_ERR_IO, true, "Failed to find \"DEFAULTS\"");
    186191        return false;
    187192    }
     
    189194    psMetadataItem *specItem = NULL;    // Item from the specs metadata
    190195    bool status = true;                 // Status of reading concepts
     196    psErrorClear();   // we're going to declare all errors "old" => won't clear stack
    191197    while ((specItem = psMetadataGetAndIncrement(specsIter))) {
    192198        pmConceptSpec *spec = specItem->data.V; // The specification
     
    215221    pmHDU *hdu = pmHDUGetLowest(fpa, chip, cell); // The HDU at the lowest level
    216222    if (!hdu) {
     223        psError(PS_ERR_UNKNOWN, true, "Can't find HDU at lowest level");
    217224        return false;
    218225    }
     
    221228    psMetadata *transSpec = psMetadataLookupMD(&mdok, cameraFormat, "TRANSLATION"); // The TRANSLATION spec
    222229    if (!mdok || !transSpec) {
     230        psError(PS_ERR_IO, true, "Failed to find \"TRANSLATION\"");
    223231        return false;
    224232    }
     
    253261                if (keys->n == 1) {
    254262                    // Only one key --- proceed as usual
    255                     headerItem = psMetadataLookup(hdu->header, keywords);
     263                    headerItem = psMemIncrRefCounter(psMetadataLookup(hdu->header, keywords));
    256264                } else {
    257265                    psListIterator *keysIter = psListIteratorAlloc(keys, PS_LIST_HEAD, false); // Iterator
     
    275283            status = false;
    276284        }
     285        psFree(headerItem);
    277286    }
    278287    psFree(specsIter);
Note: See TracChangeset for help on using the changeset viewer.