about summary refs log tree commit diff stats
path: root/src/main.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2025-01-11 22:48:50 +0100
committerbptato <nincsnevem662@gmail.com>2025-01-11 22:48:50 +0100
commit6551733999a88985aa80c00b646102a267f8575b (patch)
treedd42040e24e0dab2e4e9eee73e115c12bf2ad664 /src/main.nim
parentc86f63276ac63ea8e756df1bccc42b16b1da1204 (diff)
downloadchawan-6551733999a88985aa80c00b646102a267f8575b.tar.gz
loader: fix memory leak on x-saveoutput + various fd leaks
Diffstat (limited to 'src/main.nim')
-rw-r--r--src/main.nim4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main.nim b/src/main.nim
index 6bbd3185..7a1f73f7 100644
--- a/src/main.nim
+++ b/src/main.nim
@@ -273,8 +273,10 @@ proc main() =
   discard mkdir(cstring(config.external.tmpdir), 0o700)
   let loaderPid = forkserver.loadConfig(config)
   setControlCHook(proc() {.noconv.} = quit(1))
+  let loaderControl = newSocketStream(loaderSockVec[0])
+  loaderControl.setCloseOnExec()
   let client = newClient(config, forkserver, loaderPid, jsctx, warnings,
-    urandom, newSocketStream(loaderSockVec[0]))
+    urandom, loaderControl)
   try:
     client.pager.run(ctx.pages, ctx.contentType, ctx.charset, ctx.dump, history)
   except CatchableError: