]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
daemon/tls: proper clean up of queued protolayer contexts
authorOto Šťáva <oto.stava@nic.cz>
Mon, 22 Jul 2024 09:28:02 +0000 (11:28 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Mon, 22 Jul 2024 15:57:47 +0000 (17:57 +0200)
daemon/tls.c

index 96f036f962165d282ac23d6ff7fd35cf1c3d7d3b..173cf3c349892ff2b7d86da593dbc00c822393d1 100644 (file)
@@ -893,7 +893,21 @@ static int pl_tls_sess_data_deinit(struct pl_tls_sess_data *tls)
                tls_credentials_release(tls->server_credentials);
        }
        wire_buf_deinit(&tls->unwrap_buf);
-       queue_deinit(tls->unwrap_queue); /* TODO: break contexts? */
+
+       while (queue_len(tls->unwrap_queue) > 0) {
+               struct protolayer_iter_ctx *ctx = queue_head(tls->unwrap_queue);
+               protolayer_break(ctx, kr_error(EIO));
+               queue_pop(tls->unwrap_queue);
+       }
+       queue_deinit(tls->unwrap_queue);
+
+       while (queue_len(tls->wrap_queue)) {
+               struct protolayer_iter_ctx *ctx = queue_head(tls->wrap_queue);
+               protolayer_break(ctx, kr_error(EIO));
+               queue_pop(tls->wrap_queue);
+       }
+       queue_deinit(tls->wrap_queue);
+
        return kr_ok();
 }