diff --git a/src/cfgparse.c b/src/cfgparse.c index 1940330a7..52a4cb8fe 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -2324,6 +2324,12 @@ int check_config_validity() pool_head_capture = create_pool("capture", global.tune.cookie_len, MEM_F_SHARED); + /* both will have already emitted an error message if needed */ + if (!pool_head_requri || !pool_head_capture) { + err_code |= ERR_ALERT | ERR_FATAL; + goto out; + } + /* Post initialisation of the users and groups lists. */ err_code = userlist_postinit(); if (err_code != ERR_NONE) diff --git a/src/http_act.c b/src/http_act.c index 2adf6fcca..bfe8321d8 100644 --- a/src/http_act.c +++ b/src/http_act.c @@ -960,6 +960,12 @@ static enum act_parse_ret parse_http_req_capture(const char **args, int *orig_ar hdr->namelen = 0; hdr->len = len; hdr->pool = create_pool("caphdr", hdr->len + 1, MEM_F_SHARED); + if (!hdr->pool) { + memprintf(err, "out of memory"); + free(hdr); + release_sample_expr(expr); + return ACT_RET_PRS_ERR; + } hdr->index = px->nb_req_cap++; px->req_cap = hdr; diff --git a/src/proxy.c b/src/proxy.c index 41cb8042d..d3b7c0f93 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -878,6 +878,11 @@ static int proxy_parse_declare(char **args, int section, struct proxy *curpx, hdr->namelen = 0; hdr->len = len; hdr->pool = create_pool("caphdr", hdr->len + 1, MEM_F_SHARED); + if (!hdr->pool) { + memprintf(err, "out of memory"); + free(hdr); + return -1; + } if (strcmp(args[2], "request") == 0) { hdr->next = curpx->req_cap; diff --git a/src/tcp_rules.c b/src/tcp_rules.c index dd2fb74cf..68b01a496 100644 --- a/src/tcp_rules.c +++ b/src/tcp_rules.c @@ -970,6 +970,12 @@ static int tcp_parse_request_rule(char **args, int arg, int section_type, hdr->namelen = 0; hdr->len = len; hdr->pool = create_pool("caphdr", hdr->len + 1, MEM_F_SHARED); + if (!hdr->pool) { + memprintf(err, "parsing [%s:%d] : out of memory", file, line); + free(hdr); + release_sample_expr(expr); + return -1; + } hdr->index = curpx->nb_req_cap++; curpx->req_cap = hdr;