From 9189c79d744e0b9fa8d399cace5948ab9cbe55af Mon Sep 17 00:00:00 2001 From: Simon Frei Date: Fri, 23 Oct 2020 10:34:20 +0200 Subject: [PATCH] lib/api: Add missing config mod. locks (ref #7001) (#7053) --- lib/api/confighandler.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/api/confighandler.go b/lib/api/confighandler.go index 0bf3b1205..dc580adbe 100644 --- a/lib/api/confighandler.go +++ b/lib/api/confighandler.go @@ -153,6 +153,8 @@ func (c *configMuxBuilder) registerFolder(path string) { }) c.Handle(http.MethodDelete, path, func(w http.ResponseWriter, _ *http.Request, p httprouter.Params) { + c.mut.Lock() + defer c.mut.Unlock() waiter, err := c.cfg.RemoveFolder(p.ByName("id")) if err != nil { http.Error(w, err.Error(), http.StatusBadRequest) @@ -194,6 +196,8 @@ func (c *configMuxBuilder) registerDevice(path string) { }) c.Handle(http.MethodDelete, path, func(w http.ResponseWriter, _ *http.Request, p httprouter.Params) { + c.mut.Lock() + defer c.mut.Unlock() id, err := protocol.DeviceIDFromString(p.ByName("id")) waiter, err := c.cfg.RemoveDevice(id) if err != nil {