shithub: hugo

Download patch

ref: 4b3ca38b2e8aa07f6fecbba0cc150b1fab9227e3
parent: 77cbe4d60bfa708cbf695ae5f2524d4f76007e71
author: Bjørn Erik Pedersen <[email protected]>
date: Fri Feb 17 09:24:56 EST 2017

tplimpl: Fix data race in resGetResource

Fixes #3045

--- a/tpl/tplimpl/template_resources.go
+++ b/tpl/tplimpl/template_resources.go
@@ -49,8 +49,8 @@
 	if _, ok := l.m[url]; !ok {
 		l.m[url] = &sync.Mutex{}
 	}
-	l.Unlock() // call this Unlock before the next lock will be called. NFI why but defer doesn't work.
 	l.m[url].Lock()
+	l.Unlock()
 }
 
 // URLUnlock unlocks an URL when the download has been finished. Use only in defer calls.