From 0bf30fbde398036eb41e0b69ef997237ae4e65ff Mon Sep 17 00:00:00 2001 From: Aki Tuomi Date: Tue, 6 Aug 2019 08:44:18 +0300 Subject: [PATCH] auth: Do not unref policy payload too early This can cause the context to be free'd too early leading to crashes. --- src/auth/auth-policy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/auth/auth-policy.c b/src/auth/auth-policy.c index 9efc81330d..6318db8bf7 100644 --- a/src/auth/auth-policy.c +++ b/src/auth/auth-policy.c @@ -347,7 +347,6 @@ void auth_policy_parse_response(struct policy_lookup_ctx *context) else if (context->parse_state == POLICY_RESULT) context->parse_error = FALSE; } - i_stream_unref(&context->payload); if (context->parse_error) { context->result = (context->set->policy_reject_on_fail ? -1 : 0); @@ -376,6 +375,7 @@ void auth_policy_parse_response(struct policy_lookup_ctx *context) } auth_policy_callback(context); + i_stream_unref(&context->payload); } static -- 2.47.3