mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-13 15:04:42 +00:00
MINOR: spoe: Set the argument chunk size to 0 when SPOE variables are checked
When SPOE variables are registered during HAProxy startup, the argument used to call the function vars_check_arg() uses the trash area. To be sure it is never released by the callee function, the size of the internal chunk (arg.data.str) is set to 0. It is important to do so because, to fix a memory leak, this buffer must be released by the function vars_check_arg(). This patch must be backported to 1.9.
This commit is contained in:
parent
1bbc74b554
commit
bf9bcb0a00
@ -4173,6 +4173,7 @@ parse_spoe_flt(char **args, int *cur_arg, struct proxy *px,
|
|||||||
arg.type = ARGT_STR;
|
arg.type = ARGT_STR;
|
||||||
arg.data.str.area = trash.area;
|
arg.data.str.area = trash.area;
|
||||||
arg.data.str.data = trash.data;
|
arg.data.str.data = trash.data;
|
||||||
|
arg.data.str.size = 0; /* Set it to 0 to not release it in vars_check_args() */
|
||||||
if (!vars_check_arg(&arg, err)) {
|
if (!vars_check_arg(&arg, err)) {
|
||||||
memprintf(err, "SPOE agent '%s': failed to register variable %s.%s (%s)",
|
memprintf(err, "SPOE agent '%s': failed to register variable %s.%s (%s)",
|
||||||
curagent->id, curagent->var_pfx, curagent->var_on_error, *err);
|
curagent->id, curagent->var_pfx, curagent->var_on_error, *err);
|
||||||
@ -4189,6 +4190,7 @@ parse_spoe_flt(char **args, int *cur_arg, struct proxy *px,
|
|||||||
arg.type = ARGT_STR;
|
arg.type = ARGT_STR;
|
||||||
arg.data.str.area = trash.area;
|
arg.data.str.area = trash.area;
|
||||||
arg.data.str.data = trash.data;
|
arg.data.str.data = trash.data;
|
||||||
|
arg.data.str.size = 0; /* Set it to 0 to not release it in vars_check_args() */
|
||||||
if (!vars_check_arg(&arg, err)) {
|
if (!vars_check_arg(&arg, err)) {
|
||||||
memprintf(err, "SPOE agent '%s': failed to register variable %s.%s (%s)",
|
memprintf(err, "SPOE agent '%s': failed to register variable %s.%s (%s)",
|
||||||
curagent->id, curagent->var_pfx, curagent->var_t_process, *err);
|
curagent->id, curagent->var_pfx, curagent->var_t_process, *err);
|
||||||
@ -4205,6 +4207,7 @@ parse_spoe_flt(char **args, int *cur_arg, struct proxy *px,
|
|||||||
arg.type = ARGT_STR;
|
arg.type = ARGT_STR;
|
||||||
arg.data.str.area = trash.area;
|
arg.data.str.area = trash.area;
|
||||||
arg.data.str.data = trash.data;
|
arg.data.str.data = trash.data;
|
||||||
|
arg.data.str.size = 0; /* Set it to 0 to not release it in vars_check_args() */
|
||||||
if (!vars_check_arg(&arg, err)) {
|
if (!vars_check_arg(&arg, err)) {
|
||||||
memprintf(err, "SPOE agent '%s': failed to register variable %s.%s (%s)",
|
memprintf(err, "SPOE agent '%s': failed to register variable %s.%s (%s)",
|
||||||
curagent->id, curagent->var_pfx, curagent->var_t_process, *err);
|
curagent->id, curagent->var_pfx, curagent->var_t_process, *err);
|
||||||
@ -4410,6 +4413,7 @@ parse_spoe_flt(char **args, int *cur_arg, struct proxy *px,
|
|||||||
arg.type = ARGT_STR;
|
arg.type = ARGT_STR;
|
||||||
arg.data.str.area = trash.area;
|
arg.data.str.area = trash.area;
|
||||||
arg.data.str.data = trash.data;
|
arg.data.str.data = trash.data;
|
||||||
|
arg.data.str.size = 0; /* Set it to 0 to not release it in vars_check_args() */
|
||||||
if (!vars_check_arg(&arg, err)) {
|
if (!vars_check_arg(&arg, err)) {
|
||||||
memprintf(err, "SPOE agent '%s': failed to register variable %s.%s (%s)",
|
memprintf(err, "SPOE agent '%s': failed to register variable %s.%s (%s)",
|
||||||
curagent->id, curagent->var_pfx, vph->name, *err);
|
curagent->id, curagent->var_pfx, vph->name, *err);
|
||||||
|
Loading…
Reference in New Issue
Block a user