--- a/src/server/plugins/postgresql/vfs.c Mon Jan 31 17:18:12 2022 +0100 +++ b/src/server/plugins/postgresql/vfs.c Mon Jan 31 21:33:46 2022 +0100 @@ -366,5 +366,15 @@ } void pg_vfs_dirio_close(VFS_DIR dir) { + pool_handle_t *pool = dir->ctx->pool; + PgDir *pg = dir->data; + if(pg->result) { + PQclear(pg->result); + } + PgFile *pgfile = pg->file->data; + pool_free(pool, pgfile); + pool_free(pool, pg->file); + pool_free(pool, pg); + pool_free(pool, dir); }