BUG/MINOR: http-htx: Fix a leak on error path during http reply parsing
When "hdr" arguments of an http reply are parsed, the allocated header may leak on error path. Adding it to the header list earlier fixes the issue. This patch should partly fix the issue #645. No backport needed.
This commit is contained in:
parent
63d4824f64
commit
d6e3123176
|
@ -1538,13 +1538,13 @@ struct http_reply *http_parse_http_reply(const char **args, int *orig_arg, struc
|
||||||
memprintf(errmsg, "'%s' : out of memory", args[cur_arg-1]);
|
memprintf(errmsg, "'%s' : out of memory", args[cur_arg-1]);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
LIST_ADDQ(&reply->hdrs, &hdr->list);
|
||||||
LIST_INIT(&hdr->value);
|
LIST_INIT(&hdr->value);
|
||||||
hdr->name = ist(strdup(args[cur_arg]));
|
hdr->name = ist(strdup(args[cur_arg]));
|
||||||
if (!isttest(hdr->name)) {
|
if (!isttest(hdr->name)) {
|
||||||
memprintf(errmsg, "out of memory");
|
memprintf(errmsg, "out of memory");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
LIST_ADDQ(&reply->hdrs, &hdr->list);
|
|
||||||
if (!parse_logformat_string(args[cur_arg+1], px, &hdr->value, LOG_OPT_HTTP, cap, errmsg))
|
if (!parse_logformat_string(args[cur_arg+1], px, &hdr->value, LOG_OPT_HTTP, cap, errmsg))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue