diff --git a/src/proto_http.c b/src/proto_http.c index 48cb383a0..39900deac 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -7566,8 +7566,10 @@ void http_end_txn(struct stream *s) memset(s->res_cap, 0, fe->nb_rsp_cap * sizeof(void *)); } - vars_prune(&s->vars_txn, s->sess, s); - vars_prune(&s->vars_reqres, s->sess, s); + if (!LIST_ISEMPTY(&s->vars_txn.head)) + vars_prune(&s->vars_txn, s->sess, s); + if (!LIST_ISEMPTY(&s->vars_reqres.head)) + vars_prune(&s->vars_reqres, s->sess, s); } /* to be used at the end of a transaction to prepare a new one */ diff --git a/src/stream.c b/src/stream.c index ad1ccbee4..d27dae3a2 100644 --- a/src/stream.c +++ b/src/stream.c @@ -376,8 +376,10 @@ static void stream_free(struct stream *s) } /* Cleanup all variable contexts. */ - vars_prune(&s->vars_txn, s->sess, s); - vars_prune(&s->vars_reqres, s->sess, s); + if (!LIST_ISEMPTY(&s->vars_txn.head)) + vars_prune(&s->vars_txn, s->sess, s); + if (!LIST_ISEMPTY(&s->vars_reqres.head)) + vars_prune(&s->vars_reqres, s->sess, s); stream_store_counters(s); @@ -2258,8 +2260,10 @@ redo: /* prune the request variables and swap to the response variables. */ if (s->vars_reqres.scope != SCOPE_RES) { - vars_prune(&s->vars_reqres, s->sess, s); - vars_init(&s->vars_reqres, SCOPE_RES); + if (!LIST_ISEMPTY(&s->vars_reqres.head)) { + vars_prune(&s->vars_reqres, s->sess, s); + vars_init(&s->vars_reqres, SCOPE_RES); + } } do {