]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
reset destructor on shutdown
authorAlan T. DeKok <aland@freeradius.org>
Tue, 1 Jul 2025 15:44:48 +0000 (11:44 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 1 Jul 2025 15:45:51 +0000 (11:45 -0400)
src/lib/bio/base.c
src/lib/bio/mem.c

index f37d2a00a40279db0d2cef800b9283fa1774a9a1..5e7a6033e2815cc04ce73ac0cf4ef32388fa96ee 100644 (file)
@@ -167,16 +167,14 @@ int fr_bio_shutdown(fr_bio_t *bio)
        for (/* nothing */; this != NULL; this = fr_bio_next(this)) {
                my = (fr_bio_common_t *) this;
 
-               if (!my->priv_cb.shutdown) continue;
-
-               /*
-                *      The EOF handler said it's NOT at EOF, so we stop processing here.
-                */
-               my->priv_cb.shutdown(&my->bio);
-               my->priv_cb.shutdown = NULL;
+               if (my->priv_cb.shutdown) {
+                       my->priv_cb.shutdown(&my->bio);
+                       my->priv_cb.shutdown = NULL;
+               }
 
                my->bio.read = fr_bio_shutdown_read;
                my->bio.write = fr_bio_shutdown_write;
+               talloc_set_destructor(my, NULL);
        }
 
        /*
index 56376e138f574bfe04b8de04605fc00aaf039902..5829d485b2d43c969e8ac2f96141f2427a1b54f2 100644 (file)
@@ -683,15 +683,6 @@ static int fr_bio_mem_call_verify(fr_bio_t *bio, void *packet_ctx, size_t *size)
        return -1;
 }
 
-/*
- *     The application can read from the BIO until EOF, but cannot write to it.
- */
-static void fr_bio_mem_shutdown(fr_bio_t *bio)
-{
-       bio->read = fr_bio_mem_read_eof;
-       bio->write = fr_bio_null_write;
-}
-
 /** Allocate a memory buffer bio for either reading or writing.
  */
 static bool fr_bio_mem_buf_alloc(fr_bio_mem_t *my, fr_bio_buf_t *buf, size_t size)
@@ -784,7 +775,6 @@ fr_bio_t *fr_bio_mem_alloc(TALLOC_CTX *ctx, size_t read_size, size_t write_size,
                 *      just doing packet verification/
                 */
                my->priv_cb.eof = fr_bio_mem_eof;
-               my->priv_cb.shutdown = fr_bio_mem_shutdown;
        }
 
        fr_bio_chain(&my->bio, next);
@@ -823,7 +813,6 @@ fr_bio_t *fr_bio_mem_source_alloc(TALLOC_CTX *ctx, size_t write_size, fr_bio_t *
        /*
         *      @todo - have write pause / write resume callbacks?
         */
-       my->priv_cb.shutdown = fr_bio_mem_shutdown;
 
        fr_bio_chain(&my->bio, next);