Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / libgo / go / crypto / x509 / root_darwin.go
index 0f99581..ad3bfb4 100644 (file)
@@ -70,11 +70,12 @@ func initSystemRoots() {
 
        var data C.CFDataRef = nil
        err := C.FetchPEMRoots(&data)
-       if err != -1 {
-               defer C.CFRelease(C.CFTypeRef(data))
-               buf := C.GoBytes(unsafe.Pointer(C.CFDataGetBytePtr(data)), C.int(C.CFDataGetLength(data)))
-               roots.AppendCertsFromPEM(buf)
+       if err == -1 {
+               return
        }
 
+       defer C.CFRelease(C.CFTypeRef(data))
+       buf := C.GoBytes(unsafe.Pointer(C.CFDataGetBytePtr(data)), C.int(C.CFDataGetLength(data)))
+       roots.AppendCertsFromPEM(buf)
        systemRoots = roots
 }