From be992868efbf39bb29bad5b2e4e0f093fbecc594 Mon Sep 17 00:00:00 2001 From: Dag Haavi Finstad Date: Tue, 19 Apr 2016 13:10:32 +0200 Subject: [PATCH] Handle host:port command line parsing failure Fixes: #72 --- src/configuration.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/configuration.c b/src/configuration.c index f9b0ac44..826fd396 100644 --- a/src/configuration.c +++ b/src/configuration.c @@ -635,16 +635,19 @@ config_param_validate(char *k, char *v, hitch_config *cfg, fa = front_arg_new(); r = config_param_host_port_wildcard(v, &fa->ip, &fa->port, &certfile, 1); - if (certfile != NULL) { - r = config_param_pem_file(certfile, &cert); - if (r != 0) { - AN(cert); - HASH_ADD_KEYPTR(hh, fa->certs, cert->filename, - strlen(cert->filename), cert); - } - free(certfile); + if (r != 0) { + if (certfile != NULL) { + r = config_param_pem_file(certfile, &cert); + if (r != 0) { + AN(cert); + HASH_ADD_KEYPTR(hh, + fa->certs, cert->filename, + strlen(cert->filename), cert); + } + free(certfile); + } + r = front_arg_add(cfg, fa); } - r = front_arg_add(cfg, fa); } else if (strcmp(k, CFG_BACKEND) == 0) { free(cfg->BACK_PORT); free(cfg->BACK_IP);