From 78ca42e0dafb091ae0d49304e2446d468ff5e79d Mon Sep 17 00:00:00 2001 From: Leo Balduf Date: Thu, 21 Apr 2022 13:49:36 +0200 Subject: [PATCH] pstoremem: fix slice preallocation in GetProtocols --- pstoremem/protobook.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pstoremem/protobook.go b/pstoremem/protobook.go index eb14a58..b2cf73e 100644 --- a/pstoremem/protobook.go +++ b/pstoremem/protobook.go @@ -131,7 +131,7 @@ func (pb *memoryProtoBook) GetProtocols(p peer.ID) ([]string, error) { s.RLock() defer s.RUnlock() - out := make([]string, 0, len(s.protocols)) + out := make([]string, 0, len(s.protocols[p])) for k := range s.protocols[p] { out = append(out, k) }