mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-05-04 12:41:00 +02:00
BUG/MINOR: sample: Memory leak of sample_expr structure in case of error
If an errors occurs during the sample expression parsing, the alloced sample_expr is not freed despite having its main pointer reset. This fixes GitHub issue #1046. It could be backported as far as 1.8.
This commit is contained in:
parent
a1eea3bbb1
commit
22e0d9b39c
@ -839,7 +839,7 @@ struct sample_expr *sample_parse_expr(char **str, int *idx, const char *file, in
|
||||
const char *begw; /* beginning of word */
|
||||
const char *endw; /* end of word */
|
||||
const char *endt; /* end of term */
|
||||
struct sample_expr *expr;
|
||||
struct sample_expr *expr = NULL;
|
||||
struct sample_fetch *fetch;
|
||||
struct sample_conv *conv;
|
||||
unsigned long prev_type;
|
||||
@ -1022,7 +1022,7 @@ struct sample_expr *sample_parse_expr(char **str, int *idx, const char *file, in
|
||||
return expr;
|
||||
|
||||
out_error:
|
||||
/* TODO: prune_sample_expr(expr); */
|
||||
release_sample_expr(expr);
|
||||
expr = NULL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user