BUG/MINOR: pattern: Rely on the sample type to copy it in pattern_exec_match

To be thread safe, the function pattern_exec_match copy data (the pattern and
the inner sample) in thread-local variables. But when the sample is duplicated,
we must check its type and not the pattern one.

This is specific to threads, no backport is needed.
This commit is contained in:
Christopher Faulet 2017-11-09 16:14:16 +01:00 committed by Willy Tarreau
parent c5a9d5bf23
commit 09fdf4b112

View File

@ -2592,7 +2592,7 @@ struct pattern *pattern_exec_match(struct pattern_head *head, struct sample *smp
/* We also duplicate the sample data for
same reason */
if (pat->data && (pat->data != &static_sample_data)) {
switch(pat->type) {
switch(pat->data->type) {
case SMP_T_STR:
static_sample_data.type = SMP_T_STR;
static_sample_data.u.str = *get_trash_chunk();