IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 15, 2007, 3:55:36 PM (19 years ago)
Author:
jhoblitt
Message:

handle p2toolConfig() errors properly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools/src/chiptoolConfig.c

    r11702 r11843  
    2727#include "p2tool.h"
    2828
    29 // this function can not fail -- exits on error
    3029pxConfig *p2toolConfig(pxConfig *config, int argc, char **argv) {
    3130    if (!config) {
     
    3837    if (! config->modules) {
    3938        psError(PS_ERR_UNKNOWN, false, "Can't find site configuration");
    40         goto FAIL;
     39        psFree(config);
     40        return NULL;
    4141    }
    4242
     
    186186        if (config->mode) { \
    187187            psError(PS_ERR_UNKNOWN, true, "only one mode selection is allowed"); \
    188             goto FAIL; \
     188            psFree(config); \
     189            return NULL; \
    189190        } \
    190191        config->mode = modeval; \
     
    233234
    234235        psFree(argSets);
    235         goto FAIL;
     236        psFree(config);
     237        return NULL;
    236238    }
    237239
     
    246248        if (!psMetadataAddStr(config->where, PS_LIST_TAIL, #name, 0, "==", str)) {\
    247249            psError(PS_ERR_UNKNOWN, false, "failed to add item " #name); \
    248             goto FAIL; \
     250            psFree(config); \
     251            return NULL; \
    249252        } \
    250253    } \
     
    264267            if (!psMetadataAddStr(config->where, PS_LIST_TAIL, "camera", 0, "==", str)) {
    265268                psError(PS_ERR_UNKNOWN, false, "failed to add item camera");
    266                 goto FAIL;
     269                psFree(config);
     270                return NULL;
    267271            }
    268272        }
     
    291295    if (!config->dbh) {
    292296        psError(PS_ERR_UNKNOWN, false, "Can't configure database");
    293         goto FAIL;
     297        psFree(config);
     298        return NULL;
    294299    }
    295300
     
    299304
    300305    return config;
    301 
    302 FAIL:
    303     psFree(config);
    304     pmConfigDone();
    305     psLibFinalize();
    306     exit(EXIT_FAILURE);
    307306}
Note: See TracChangeset for help on using the changeset viewer.