stats: forgot to close the file in web serving

This commit is contained in:
cws 2017-06-06 05:57:33 -04:00
parent ae75b23252
commit b998347f33
1 changed files with 1 additions and 0 deletions

View File

@ -217,6 +217,7 @@ func (p *StatsPlugin) Help(e string, m []string) {
func (p *StatsPlugin) serveQuery(w http.ResponseWriter, r *http.Request) { func (p *StatsPlugin) serveQuery(w http.ResponseWriter, r *http.Request) {
f, err := os.Open(p.bot.Config().Stats.DBPath) f, err := os.Open(p.bot.Config().Stats.DBPath)
defer f.Close()
if err != nil { if err != nil {
log.Printf("Error opening DB for web service: %s", err) log.Printf("Error opening DB for web service: %s", err)
fmt.Fprintf(w, "Error opening DB") fmt.Fprintf(w, "Error opening DB")