matcha
matcha copied to clipboard
BUG: Missing nil checks on file operations in fetcher
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
- Open file for attachment processing
- Error occurs in processing
- 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()
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).
closing