mirror of https://github.com/velour/catbase.git
stats: forgot to close the file in web serving
This commit is contained in:
parent
ae75b23252
commit
b998347f33
|
@ -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")
|
||||||
|
|
Loading…
Reference in New Issue