Don't leak the http handlers.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4801 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2024-01-27 17:11:24 +00:00
parent 55fb5dce1a
commit 14a4117aff
7 changed files with 34 additions and 10 deletions

View File

@ -1838,6 +1838,15 @@ void tf_task_destroy(tf_task_t* task)
{
tf_ssb_destroy(task->_ssb);
}
/* This ensures the HTTP handlers get cleaned up. */
if (task->_trusted)
{
JSValue global = JS_GetGlobalObject(task->_context);
JS_SetPropertyStr(task->_context, global, "httpd", JS_UNDEFINED);
JS_FreeValue(task->_context, global);
}
JS_FreeContext(task->_context);
JS_FreeRuntime(task->_runtime);