matcha icon indicating copy to clipboard operation
matcha copied to clipboard

BUG: Missing nil checks on file operations in fetcher

Open andrinoff opened this issue 7 months ago • 2 comments

Describe the bug File operations at fetcher/fetcher.go:1029,1035 open files without defer close. If error occurs after open, file descriptor leaks.

To reproduce

  1. Open file for attachment processing
  2. Error occurs in processing
  3. File never closed, descriptor leaked

Expected behavior Use defer file.Close() immediately after successful open

Matcha version master

OS All

Additional context Files: fetcher/fetcher.go lines 1029, 1035 Missing defer on file.Close()

andrinoff avatar Apr 21 '26 14:04 andrinoff

Hi @andrinoff

This appears to already be fixed in the current code, the file open is wrapped in a closure with defer f.Close() (see #894).

mavonx avatar Apr 27 '26 08:04 mavonx

closing

LeaWhoCodes avatar Apr 27 '26 08:04 LeaWhoCodes