IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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

properly hanlde dettoolConfig() errors

File:
1 edited

Legend:

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

    r11816 r11855  
    2727#include "dettool.h"
    2828
    29 // this function can not fail -- exits on error
    3029pxConfig *dettoolConfig(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
     
    785785            psFree(argset); \
    786786            psFree(argSets); \
    787             goto FAIL; \
     787            psFree(config); \
     788            return NULL; \
    788789        } \
    789790        config->mode = modeval; \
     
    873874        psFree(iter);
    874875        psFree(argSets);
    875         goto FAIL;
     876        psFree(config);
     877        return NULL;
    876878    }
    877879
     
    886888        if (!psMetadataAddStr(config->where, PS_LIST_TAIL, #name, 0, "==", str)) {\
    887889            psError(PS_ERR_UNKNOWN, false, "failed to add item " #name); \
    888             goto FAIL; \
     890            psFree(config); \
     891            return NULL; \
    889892        } \
    890893    } \
     
    901904            if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "iteration", 0, "==", n)) {
    902905                psError(PS_ERR_UNKNOWN, false, "failed to add item iteration");
    903                 goto FAIL;
     906                psFree(config);
     907                return NULL;
    904908            }
    905909        }
     
    915919            if (!psMetadataAddStr(config->where, PS_LIST_TAIL, "camera", 0, "==", str)) {
    916920                psError(PS_ERR_UNKNOWN, false, "failed to add item camera");
    917                 goto FAIL;
     921                psFree(config);
     922                return NULL;
    918923            }
    919924        }
     
    927932            if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "imfiles", 0, "==", n)) {
    928933                psError(PS_ERR_UNKNOWN, false, "failed to add item imfiles");
    929                 goto FAIL;
     934                psFree(config);
     935                return NULL;
    930936            }
    931937        }
     
    939945            if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "p1_version", 0, "==", n)) {
    940946                psError(PS_ERR_UNKNOWN, false, "failed to add item p1_version");
    941                 goto FAIL;
     947                psFree(config);
     948                return NULL;
    942949            }
    943950        }
     
    951958            if (!psMetadataAddBool(config->where, PS_LIST_TAIL, "accept", 0, "==", !boolean)) {
    952959                psError(PS_ERR_UNKNOWN, false, "failed to add item reject");
    953                 goto FAIL;
     960                psFree(config);
     961                return NULL;
    954962            }
    955963        }
     
    967975    if (!config->dbh) {
    968976        psError(PS_ERR_UNKNOWN, false, "Can't configure database");
    969         goto FAIL;
     977        psFree(config);
     978        return NULL;
    970979    }
    971980
     
    975984
    976985    return config;
    977 
    978 FAIL:
    979     psFree(config);
    980     pmConfigDone();
    981     psLibFinalize();
    982     exit(EXIT_FAILURE);
    983986}
Note: See TracChangeset for help on using the changeset viewer.