}
bind_conf = bind_conf_alloc(curproxy, file, linenum, args[1], xprt_get(XPRT_RAW));
- if (!bind_conf) {
- ha_alert("Out of memory error.\n");
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ if (!bind_conf)
+ goto alloc_error;
+
/* use default settings for unix sockets */
bind_conf->settings.ux.uid = global.unix_bind.ux.uid;
bind_conf->settings.ux.gid = global.unix_bind.ux.gid;
free(curproxy->monitor_uri);
curproxy->monitor_uri_len = strlen(args[1]);
curproxy->monitor_uri = calloc(1, curproxy->monitor_uri_len + 1);
- if (!curproxy->monitor_uri) {
- ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ if (!curproxy->monitor_uri)
+ goto alloc_error;
memcpy(curproxy->monitor_uri, args[1], curproxy->monitor_uri_len);
curproxy->monitor_uri[curproxy->monitor_uri_len] = '\0';
len += strlen(args[i]) + 1;
d = calloc(1, len);
- if (!d) {
- ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ if (!d)
+ goto alloc_error;
curproxy->desc = d;
d += snprintf(d, curproxy->desc + len - d, "%s", args[1]);
ha_free(&curproxy->cookie_domain);
free(curproxy->cookie_name);
curproxy->cookie_name = strdup(args[1]);
- if (!curproxy->cookie_name) {
- ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ if (!curproxy->cookie_name)
+ goto alloc_error;
curproxy->cookie_len = strlen(curproxy->cookie_name);
cur_arg = 2;
memprintf(&curproxy->cookie_domain, "%s; domain=%s", curproxy->cookie_domain, args[cur_arg+1]);
}
- if (!curproxy->cookie_domain) {
- ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
-
+ if (!curproxy->cookie_domain)
+ goto alloc_error;
cur_arg++;
}
else if (strcmp(args[cur_arg], "maxidle") == 0) {
else
memprintf(&curproxy->cookie_attrs, "%s; %s", curproxy->cookie_attrs, args[cur_arg + 1]);
- if (!curproxy->cookie_attrs) {
- ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ if (!curproxy->cookie_attrs)
+ goto alloc_error;
cur_arg++;
}
}
free(curproxy->email_alert.from);
curproxy->email_alert.from = strdup(args[2]);
- if (!curproxy->email_alert.from) {
- ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ if (!curproxy->email_alert.from)
+ goto alloc_error;
}
else if (strcmp(args[1], "mailers") == 0) {
if (*(args[1]) == 0) {
}
free(curproxy->email_alert.mailers.name);
curproxy->email_alert.mailers.name = strdup(args[2]);
- if (!curproxy->email_alert.mailers.name) {
- ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ if (!curproxy->email_alert.mailers.name)
+ goto alloc_error;
}
else if (strcmp(args[1], "myhostname") == 0) {
if (*(args[1]) == 0) {
}
free(curproxy->email_alert.myhostname);
curproxy->email_alert.myhostname = strdup(args[2]);
- if (!curproxy->email_alert.myhostname) {
- ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ if (!curproxy->email_alert.myhostname)
+ goto alloc_error;
}
else if (strcmp(args[1], "level") == 0) {
curproxy->email_alert.level = get_log_level(args[2]);
}
free(curproxy->email_alert.to);
curproxy->email_alert.to = strdup(args[2]);
- if (!curproxy->email_alert.to) {
- ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ if (!curproxy->email_alert.to)
+ goto alloc_error;
}
else {
ha_alert("parsing [%s:%d] : email-alert: unknown argument '%s'.\n",
free(curproxy->rdp_cookie_name);
curproxy->rdp_cookie_name = my_strndup(beg, end - beg);
- if (!curproxy->rdp_cookie_name) {
- ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ if (!curproxy->rdp_cookie_name)
+ goto alloc_error;
curproxy->rdp_cookie_len = end-beg;
}
else if (*(args[1] + 10) == '\0') { /* default cookie name 'msts' */
free(curproxy->rdp_cookie_name);
curproxy->rdp_cookie_name = strdup("msts");
- if (!curproxy->rdp_cookie_name) {
- ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ if (!curproxy->rdp_cookie_name)
+ goto alloc_error;
curproxy->rdp_cookie_len = strlen(curproxy->rdp_cookie_name);
}
else { /* syntax */
else
curproxy->server_state_file_name = strdup(args[1]);
- if (!curproxy->server_state_file_name) {
- ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ if (!curproxy->server_state_file_name)
+ goto alloc_error;
}
else if (strcmp(args[0], "max-session-srv-conns") == 0) {
if (warnifnotcap(curproxy, PR_CAP_FE, file, linenum, args[0], NULL))
}
free(curproxy->capture_name);
curproxy->capture_name = strdup(args[2]);
- if (!curproxy->capture_name) {
- ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ if (!curproxy->capture_name)
+ goto alloc_error;
curproxy->capture_namelen = strlen(curproxy->capture_name);
curproxy->capture_len = atol(args[4]);
curproxy->to_log |= LW_COOKIE;
if (hdr)
ha_free(&hdr->name);
ha_free(&hdr);
- ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
+ goto alloc_error;
}
hdr->index = curproxy->nb_req_cap++;
curproxy->req_cap = hdr;
if (hdr)
ha_free(&hdr->name);
ha_free(&hdr);
- ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
+ goto alloc_error;
}
hdr->index = curproxy->nb_rsp_cap++;
curproxy->rsp_cap = hdr;
/* set the desired header name, in lower case */
free(curproxy->server_id_hdr_name);
curproxy->server_id_hdr_name = strdup(args[1]);
- if (!curproxy->server_id_hdr_name) {
- ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ if (!curproxy->server_id_hdr_name)
+ goto alloc_error;
curproxy->server_id_hdr_len = strlen(curproxy->server_id_hdr_name);
ist2bin_lc(curproxy->server_id_hdr_name, ist2(curproxy->server_id_hdr_name, curproxy->server_id_hdr_len));
}
if (rule)
ha_free(&(rule->be.name));
ha_free(&rule);
- ha_alert("Out of memory error.\n");
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
+ goto alloc_error;
}
LIST_INIT(&rule->list);
LIST_ADDQ(&curproxy->switching_rules, &rule->list);
if (rule)
ha_free(&(rule->srv.name));
ha_free(&rule);
- ha_alert("Out of memory error.\n");
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
+ goto alloc_error;
}
LIST_INIT(&rule->list);
LIST_ADDQ(&curproxy->server_rules, &rule->list);
if (cond)
prune_acl_cond(cond);
ha_free(&cond);
- ha_alert("Out of memory error.\n");
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
+ goto alloc_error;
}
rule->cond = cond;
if (strcmp(args[0], "force-persist") == 0) {
if (cond)
prune_acl_cond(cond);
ha_free(&cond);
- ha_alert("Out of memory error.\n");
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
+ goto alloc_error;
}
rule->cond = cond;
rule->expr = expr;
goto out;
}
- if (!stats_check_init_uri_auth(&curproxy->uri_auth)) {
- ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ if (!stats_check_init_uri_auth(&curproxy->uri_auth))
+ goto alloc_error;
if (strcmp(args[2], "if") != 0 && strcmp(args[2], "unless") != 0) {
ha_alert("parsing [%s:%d] : '%s %s' requires either 'if' or 'unless' followed by a condition.\n",
if (cond)
prune_acl_cond(cond);
ha_free(&cond);
- ha_alert("Out of memory error.\n");
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
+ goto alloc_error;
}
rule->cond = cond;
LIST_INIT(&rule->list);
ha_alert("parsing [%s:%d] : 'uri' needs an URI prefix.\n", file, linenum);
err_code |= ERR_ALERT | ERR_FATAL;
goto out;
- } else if (!stats_set_uri(&curproxy->uri_auth, args[2])) {
- ha_alert("parsing [%s:%d] : out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ } else if (!stats_set_uri(&curproxy->uri_auth, args[2]))
+ goto alloc_error;
} else if (strcmp(args[1], "realm") == 0) {
if (*(args[2]) == 0) {
ha_alert("parsing [%s:%d] : 'realm' needs an realm name.\n", file, linenum);
err_code |= ERR_ALERT | ERR_FATAL;
goto out;
- } else if (!stats_set_realm(&curproxy->uri_auth, args[2])) {
- ha_alert("parsing [%s:%d] : out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ } else if (!stats_set_realm(&curproxy->uri_auth, args[2]))
+ goto alloc_error;
} else if (strcmp(args[1], "refresh") == 0) {
unsigned interval;
file, linenum, *err);
err_code |= ERR_ALERT | ERR_FATAL;
goto out;
- } else if (!stats_set_refresh(&curproxy->uri_auth, interval)) {
- ha_alert("parsing [%s:%d] : out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ } else if (!stats_set_refresh(&curproxy->uri_auth, interval))
+ goto alloc_error;
} else if (strcmp(args[1], "http-request") == 0) { /* request access control: allow/deny/auth */
struct act_rule *rule;
goto out;
}
- if (!stats_check_init_uri_auth(&curproxy->uri_auth)) {
- ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ if (!stats_check_init_uri_auth(&curproxy->uri_auth))
+ goto alloc_error;
if (!LIST_ISEMPTY(&curproxy->uri_auth->http_req_rules) &&
!LIST_PREV(&curproxy->uri_auth->http_req_rules, struct act_rule *, list)->cond) {
ha_alert("parsing [%s:%d] : 'auth' needs a user:password account.\n", file, linenum);
err_code |= ERR_ALERT | ERR_FATAL;
goto out;
- } else if (!stats_add_auth(&curproxy->uri_auth, args[2])) {
- ha_alert("parsing [%s:%d] : out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ } else if (!stats_add_auth(&curproxy->uri_auth, args[2]))
+ goto alloc_error;
} else if (strcmp(args[1], "scope") == 0) {
if (*(args[2]) == 0) {
ha_alert("parsing [%s:%d] : 'scope' needs a proxy name.\n", file, linenum);
err_code |= ERR_ALERT | ERR_FATAL;
goto out;
- } else if (!stats_add_scope(&curproxy->uri_auth, args[2])) {
- ha_alert("parsing [%s:%d] : out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ } else if (!stats_add_scope(&curproxy->uri_auth, args[2]))
+ goto alloc_error;
} else if (strcmp(args[1], "enable") == 0) {
- if (!stats_check_init_uri_auth(&curproxy->uri_auth)) {
- ha_alert("parsing [%s:%d] : out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ if (!stats_check_init_uri_auth(&curproxy->uri_auth))
+ goto alloc_error;
} else if (strcmp(args[1], "hide-version") == 0) {
- if (!stats_set_flag(&curproxy->uri_auth, STAT_HIDEVER)) {
- ha_alert("parsing [%s:%d] : out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ if (!stats_set_flag(&curproxy->uri_auth, STAT_HIDEVER))
+ goto alloc_error;
} else if (strcmp(args[1], "show-legends") == 0) {
- if (!stats_set_flag(&curproxy->uri_auth, STAT_SHLGNDS)) {
- ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ if (!stats_set_flag(&curproxy->uri_auth, STAT_SHLGNDS))
+ goto alloc_error;
} else if (strcmp(args[1], "show-modules") == 0) {
- if (!stats_set_flag(&curproxy->uri_auth, STAT_SHMODULES)) {
- ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ if (!stats_set_flag(&curproxy->uri_auth, STAT_SHMODULES))
+ goto alloc_error;
} else if (strcmp(args[1], "show-node") == 0) {
if (*args[2]) {
}
}
- if (!stats_set_node(&curproxy->uri_auth, args[2])) {
- ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ if (!stats_set_node(&curproxy->uri_auth, args[2]))
+ goto alloc_error;
} else if (strcmp(args[1], "show-desc") == 0) {
char *desc = NULL;
else {
if (!stats_set_desc(&curproxy->uri_auth, desc)) {
free(desc);
- ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
+ goto alloc_error;
}
free(desc);
}
free(curproxy->fwdfor_hdr_name);
curproxy->fwdfor_hdr_name = strdup(DEF_XFORWARDFOR_HDR);
- if (!curproxy->fwdfor_hdr_name) {
- ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ if (!curproxy->fwdfor_hdr_name)
+ goto alloc_error;
curproxy->fwdfor_hdr_len = strlen(DEF_XFORWARDFOR_HDR);
curproxy->except_xff_net.family = AF_UNSPEC;
}
free(curproxy->fwdfor_hdr_name);
curproxy->fwdfor_hdr_name = strdup(args[cur_arg+1]);
- if (!curproxy->fwdfor_hdr_name) {
- ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ if (!curproxy->fwdfor_hdr_name)
+ goto alloc_error;
curproxy->fwdfor_hdr_len = strlen(curproxy->fwdfor_hdr_name);
cur_arg += 2;
} else if (strcmp(args[cur_arg], "if-none") == 0) {
free(curproxy->orgto_hdr_name);
curproxy->orgto_hdr_name = strdup(DEF_XORIGINALTO_HDR);
- if (!curproxy->orgto_hdr_name) {
- ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ if (!curproxy->orgto_hdr_name)
+ goto alloc_error;
curproxy->orgto_hdr_len = strlen(DEF_XORIGINALTO_HDR);
curproxy->except_xot_net.family = AF_UNSPEC;
}
free(curproxy->orgto_hdr_name);
curproxy->orgto_hdr_name = strdup(args[cur_arg+1]);
- if (!curproxy->orgto_hdr_name) {
- ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ if (!curproxy->orgto_hdr_name)
+ goto alloc_error;
curproxy->orgto_hdr_len = strlen(curproxy->orgto_hdr_name);
cur_arg += 2;
} else {
}
free(curproxy->defbe.name);
curproxy->defbe.name = strdup(args[1]);
- if (!curproxy->defbe.name) {
- ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ if (!curproxy->defbe.name)
+ goto alloc_error;
if (alertif_too_many_args_idx(1, 0, file, linenum, args, &err_code))
goto out;
}
free(curproxy->conf.uniqueid_format_string);
curproxy->conf.uniqueid_format_string = strdup(args[1]);
- if (!curproxy->conf.uniqueid_format_string) {
- ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ if (!curproxy->conf.uniqueid_format_string)
+ goto alloc_error;
free(curproxy->conf.uif_file);
curproxy->conf.uif_file = strdup(curproxy->conf.args.file);
curproxy->conf.logformat_string != clf_http_log_format)
free(curproxy->conf.logformat_string);
curproxy->conf.logformat_string = strdup(args[1]);
- if (!curproxy->conf.logformat_string) {
- ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ if (!curproxy->conf.logformat_string)
+ goto alloc_error;
free(curproxy->conf.lfs_file);
curproxy->conf.lfs_file = strdup(curproxy->conf.args.file);
if (curproxy->conf.logformat_sd_string != default_rfc5424_sd_log_format)
free(curproxy->conf.logformat_sd_string);
curproxy->conf.logformat_sd_string = strdup(args[1]);
- if (!curproxy->conf.logformat_sd_string) {
- ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ if (!curproxy->conf.logformat_sd_string)
+ goto alloc_error;
free(curproxy->conf.lfsd_file);
curproxy->conf.lfsd_file = strdup(curproxy->conf.args.file);
curproxy->conn_src.opts |= CO_SRC_TPROXY_DYN;
free(curproxy->conn_src.bind_hdr_name);
curproxy->conn_src.bind_hdr_name = calloc(1, end - name + 1);
- if (!curproxy->conn_src.bind_hdr_name) {
- ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ if (!curproxy->conn_src.bind_hdr_name)
+ goto alloc_error;
curproxy->conn_src.bind_hdr_len = end - name;
memcpy(curproxy->conn_src.bind_hdr_name, name, end - name);
curproxy->conn_src.bind_hdr_name[end-name] = '\0';
}
free(curproxy->conn_src.iface_name);
curproxy->conn_src.iface_name = strdup(args[cur_arg + 1]);
- if (!curproxy->conn_src.iface_name) {
- ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_ABORT;
- goto out;
- }
+ if (!curproxy->conn_src.iface_name)
+ goto alloc_error;
curproxy->conn_src.iface_len = strlen(curproxy->conn_src.iface_name);
global.last_checks |= LSTCHK_NETADM;
#else
out:
free(errmsg);
return err_code;
+
+ alloc_error:
+ ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
+ err_code |= ERR_ALERT | ERR_ABORT;
+ goto out;
}