--- a/src/server/daemon/location.c Fri Dec 05 17:37:48 2025 +0100 +++ b/src/server/daemon/location.c Sun Dec 07 16:31:21 2025 +0100 @@ -90,6 +90,10 @@ } +static void location_free_regex(WSLocation *loc) { + regfree(&loc->regex); +} + WSLocation* cfg_location_get(ServerConfiguration *cfg, ConfigNode *obj) { const CxAllocator *a = cfg->a; @@ -134,6 +138,12 @@ log_ereport(LOG_FAILURE, "Location: cannot compile regex pattern %s", match_str.ptr); return NULL; } + ScfgDestr destr; + destr.destr = (cx_destructor_func)location_free_regex; + destr.data = location; + if(cxListAdd(cfg->destr, &destr)) { + return NULL; + } } ConfigNode *dir = obj->children_begin;