summaryrefslogtreecommitdiff
path: root/worker/notmuch/worker.go
diff options
context:
space:
mode:
authorNguyễn Gia Phong <mcsinyx@disroot.org>2022-01-20 01:10:08 +0700
committerRobin Jarry <robin@jarry.cc>2022-01-19 20:18:00 +0100
commit904ffacb0e521218ba1f41e2e5c26d9ac41c9969 (patch)
tree4bb0dbe000b1241586f7fb0635ee076f70c22fe2 /worker/notmuch/worker.go
parentbeae17a6da37402d1c69dc76b476f55cbae982b8 (diff)
downloadaerc-904ffacb0e521218ba1f41e2e5c26d9ac41c9969.zip
maildir,notmuch: avoid leaking open files
Previously, Message.NewReader returned the wrapped buffered reader without a reference to the opened file, so the files descriptors were left unclosed after reading. Now, the file reader is returned directly and closed on the call site. Buffering is not needed here because it is an implementation detail of go-message. Fixes: https://todo.sr.ht/~rjarry/aerc/9
Diffstat (limited to 'worker/notmuch/worker.go')
-rw-r--r--worker/notmuch/worker.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/worker/notmuch/worker.go b/worker/notmuch/worker.go
index 575cd56..d95d6ba 100644
--- a/worker/notmuch/worker.go
+++ b/worker/notmuch/worker.go
@@ -367,6 +367,7 @@ func (w *worker) handleFetchFullMessages(msg *types.FetchFullMessages) error {
w.w.Logger.Printf("could not get message reader: %v", err)
return err
}
+ defer r.Close()
w.w.PostMessage(&types.FullMessage{
Message: types.RespondTo(msg),
Content: &models.FullMessage{