]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Fix allocation of empty DhtNodes in TorrentSpec
authorMatt Joiner <anacrolix@gmail.com>
Wed, 11 Aug 2021 02:27:00 +0000 (12:27 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Wed, 11 Aug 2021 02:27:00 +0000 (12:27 +1000)
https://github.com/anacrolix/torrent/pull/536#issuecomment-896392738

spec.go

diff --git a/spec.go b/spec.go
index e12bb0cb26367626b53fbec35392b0a0e7c4f691..6708db9093ce6420c73bd5312ee067944a3f578f 100644 (file)
--- a/spec.go
+++ b/spec.go
@@ -60,7 +60,7 @@ func TorrentSpecFromMetaInfoErr(mi *metainfo.MetaInfo) (*TorrentSpec, error) {
                DisplayName: info.Name,
                Webseeds:    mi.UrlList,
                DhtNodes: func() (ret []string) {
-                       ret = make([]string, len(mi.Nodes))
+                       ret = make([]string, 0, len(mi.Nodes))
                        for _, node := range mi.Nodes {
                                ret = append(ret, string(node))
                        }