]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: oauth2 - Make sure db_oauth2_request.req is set to NULL when it gets freed.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 15 Mar 2017 22:15:10 +0000 (00:15 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 15 Mar 2017 23:28:28 +0000 (01:28 +0200)
Doesn't fix anything, but makes it clearer that req->req must not be
aborted anymore after this stage, because it gets freed anyway.

src/auth/db-oauth2.c

index 284d7311631c8fab5e337ec7696939ac0a689aec..f2382b929a3b5f8d323ae8abdad4f589aba26609 100644 (file)
@@ -520,6 +520,8 @@ static void
 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;
@@ -533,7 +535,6 @@ db_oauth2_introspect_continue(struct oauth2_introspection_result *result,
 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;
@@ -555,6 +556,8 @@ static void
 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 ?