projects
/
haproxy-2.1.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
22c4336
)
BUG/MINOR: sample: Memory leak of sample_expr structure in case of error
author
Remi Tricot-Le Breton
<rlebreton@haproxy.com>
Tue, 12 Jan 2021 13:55:12 +0000
(14:55 +0100)
committer
Christopher Faulet
<cfaulet@haproxy.com>
Tue, 26 Jan 2021 11:07:27 +0000
(12:07 +0100)
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.
(cherry picked from commit
22e0d9b39cfb238e7bf866b3d78aa9b393004508
)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit
54c88770d37ce28077dd4a20b8ffbb54a56cca8b
)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit
780316e86b7170fe2951235f9bf214f26502fc14
)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
src/sample.c
patch
|
blob
|
history
diff --git
a/src/sample.c
b/src/sample.c
index
b2f4245
..
6b395f6
100644
(file)
--- a/
src/sample.c
+++ b/
src/sample.c
@@
-831,7
+831,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;
@@
-1023,7
+1023,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;
}