diff --git a/lxd/identities.go b/lxd/identities.go index a92a17fa1542..120301d55989 100644 --- a/lxd/identities.go +++ b/lxd/identities.go @@ -1885,7 +1885,8 @@ func updateIdentityCacheFromLocal(d *Daemon) error { return fmt.Errorf("Failed reading certificates from local database: %w", err) } - var identityCacheEntries []identity.CacheEntry + // identityCacheEntries needs to be pre-allocated. + identityCacheEntries := make([]identity.CacheEntry, 0) for _, dbCert := range localServerCerts { certBlock, _ := pem.Decode([]byte(dbCert.Certificate)) if certBlock == nil {