IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 16, 2007, 12:12:49 PM (19 years ago)
Author:
jhoblitt
Message:

properly handle p4toolConfig() errors

File:
1 edited

Legend:

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

    r11810 r11852  
    2727#include "p4tool.h"
    2828
    29 // this function can not fail -- exits on error
    3029pxConfig *p4toolConfig(pxConfig *config, int argc, char **argv) {
    3130    if (!config) {
     
    3938    if (!config->modules) {
    4039        psError(PS_ERR_UNKNOWN, false, "Can't find site configuration");
    41         goto FAIL;
     40        psFree(config);
     41        return NULL;
    4242    }
    4343
     
    188188        if (config->mode) { \
    189189            psError(PS_ERR_UNKNOWN, true, "only one mode selection is allowed"); \
    190             goto FAIL; \
     190            psFree(config); \
     191            return NULL; \
    191192        } \
    192193        config->mode = modeval; \
     
    248249
    249250        psFree(argSets);
    250         goto FAIL;
     251        psFree(config);
     252        return NULL;
    251253    }
    252254
     
    261263        if (!psMetadataAddStr(config->where, PS_LIST_TAIL, #name, 0, "==", str)) {\
    262264            psError(PS_ERR_UNKNOWN, false, "failed to add item " #name); \
    263             goto FAIL; \
     265            psFree(config); \
     266            return NULL; \
    264267        } \
    265268    } \
     
    273276        if (!psMetadataAddS32(config->where, PS_LIST_TAIL, #name, 0, "==", s32)) { \
    274277            psError(PS_ERR_UNKNOWN, false, "failed to add item " #name); \
    275             goto FAIL; \
     278            psFree(config); \
     279            return NULL; \
    276280        } \
    277281    } \
     
    288292        if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "p4_id", 0, "==", (psS32)atoi(str))) {
    289293            psError(PS_ERR_UNKNOWN, false, "failed to add item p4_id");
    290             goto FAIL;
     294            psFree(config);
     295            return NULL;
    291296        }
    292297    }
     
    307312    if (!config->dbh) {
    308313        psError(PS_ERR_UNKNOWN, false, "Can't configure database");
    309         goto FAIL;
     314        psFree(config);
     315        return NULL;
    310316    }
    311317
     
    315321
    316322    return config;
    317 
    318 FAIL:
    319     psFree(config);
    320     pmConfigDone();
    321     psLibFinalize();
    322     exit(EXIT_FAILURE);
    323 }
     323}
Note: See TracChangeset for help on using the changeset viewer.