From 3f4b161850618c9c026b06fcc694753e8ccff83d Mon Sep 17 00:00:00 2001 From: Steve Yen Date: Wed, 21 Mar 2018 10:19:02 -0700 Subject: [PATCH] scorch zap postingsIter reuses array positions slice --- index/scorch/segment/zap/posting.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index/scorch/segment/zap/posting.go b/index/scorch/segment/zap/posting.go index 3fecaa23..e994617a 100644 --- a/index/scorch/segment/zap/posting.go +++ b/index/scorch/segment/zap/posting.go @@ -448,10 +448,10 @@ func (i *PostingsIterator) readLocation(l *Location) error { l.pos = pos l.start = start l.end = end - if numArrayPos > 0 { + if cap(l.ap) < int(numArrayPos) { l.ap = make([]uint64, int(numArrayPos)) } else { - l.ap = l.ap[:0] + l.ap = l.ap[:int(numArrayPos)] } }