Closing a file that was left open, working on profiling app for memory leak on Windows

This commit is contained in:
2018-01-19 19:59:23 -05:00
parent a310d64ce4
commit 1467c3d003
22 changed files with 3667 additions and 15 deletions

View File

@@ -85,6 +85,7 @@ func readTorrentFileFromDB(element *Storage.TorrentLocal, tclient *torrent.Clien
if err != nil {
Logger.WithFields(logrus.Fields{"tempfile": tempFile, "err": err}).Error("Unable to create tempfile")
}
defer tempFile.Close() //Todo.. if we remove this do we need to close it?
defer os.Remove(tempFile.Name())
if _, err := tempFile.Write(element.TorrentFile); err != nil { //writing out out the entire file back into the temp dir from boltdb
Logger.WithFields(logrus.Fields{"tempfile": tempFile, "err": err}).Error("Unable to write to tempfile")