changeset 21729:dfcfdbbe1fd1

auth: oauth2 - Make sure db_oauth2_request.req is set to NULL when it gets freed. Doesn't fix anything, but makes it clearer that req->req must not be aborted anymore after this stage, because it gets freed anyway.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Thu, 16 Mar 2017 00:15:10 +0200
parents fb3278b43cdd
children d6ed6978cbe7
files src/auth/db-oauth2.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/auth/db-oauth2.c	Thu Mar 16 00:13:08 2017 +0200
+++ b/src/auth/db-oauth2.c	Thu Mar 16 00:15:10 2017 +0200
@@ -506,6 +506,8 @@
 db_oauth2_introspect_continue(struct oauth2_introspection_result *result,
 			      struct db_oauth2_request *req)
 {
+	req->req = NULL;
+
 	if (!result->success) {
 		/* fail here */
 		req->failed = TRUE;
@@ -519,7 +521,6 @@
 static void db_oauth2_lookup_introspect(struct db_oauth2_request *req)
 {
 	struct oauth2_request_input input;
-	i_assert(req->req != NULL);
 	i_zero(&input);
 
 	input.token = req->token;
@@ -541,6 +542,8 @@
 db_oauth2_lookup_continue(struct oauth2_token_validation_result *result,
 			  struct db_oauth2_request *req)
 {
+	req->req = NULL;
+
 	if (!result->success || !result->valid) {
 		/* no point going forward */
 		req->result = result->success ?