internal/impl: fix race ExtensionInfo.lazyInitSlow

The xi.init flag should not be set until after we have truly
initialized everything.

Change-Id: I43dcb300917145ce19a7199fa871acd0df325c6c
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/194439
Reviewed-by: Damien Neil <dneil@google.com>
diff --git a/internal/impl/extension.go b/internal/impl/extension.go
index c64f8f5..40074fc 100644
--- a/internal/impl/extension.go
+++ b/internal/impl/extension.go
@@ -145,7 +145,7 @@
 	if xi.init == extensionInfoFullInit {
 		return
 	}
-	atomic.StoreUint32(&xi.init, extensionInfoFullInit)
+	defer atomic.StoreUint32(&xi.init, extensionInfoFullInit)
 
 	if xi.desc == nil {
 		xi.initFromLegacy()