From 46e44e308746a2542229a69c5da7571e46c4e1b7 Mon Sep 17 00:00:00 2001 From: Chia-Hao Chiu Date: Wed, 5 Aug 2026 17:16:23 +0800 Subject: [PATCH] Destroy mempool on module exit to fix memory leak khttpd_init() preallocates POOL_MIN_NR buffers when creating http_buf_pool, but khttpd_exit() never releases the pool, so the buffers stay allocated after every module unload until reboot. Adding mempool_destroy() on the exit path releases them and resolves the leak. Signed-off-by: Chia-Hao Chiu --- main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/main.c b/main.c index 692886a..bb9a346 100644 --- a/main.c +++ b/main.c @@ -184,6 +184,7 @@ static void __exit khttpd_exit(void) send_sig(SIGTERM, http_server, 1); kthread_stop(http_server); close_listen_socket(listen_socket); + mempool_destroy(http_buf_pool); pr_info("module unloaded\n"); }