This was an utterly idiotic API; if you accept pointers, you can't just assume ownership over them and unconditionally destroy them whenever you like too.
This broke the captive portal: when it stopped, it deinitialized the webserver, which deleted its handlers. As the captive portal object itself was one of the handlers, it and its member objects were now destroyed, and that caused its own continuing teardown to use-after-free or double-free (see esphome/esphome#2686).
This was an utterly idiotic API; if you accept pointers, you can't just assume ownership over them and unconditionally destroy them whenever you like too.
This broke the captive portal: when it stopped, it deinitialized the webserver, which deleted its handlers. As the captive portal object itself was one of the handlers, it and its member objects were now destroyed, and that caused its own continuing teardown to use-after-free or double-free (see esphome/esphome#2686).