Always add additional space if no more is available

Change-Id: If08b2d839489d40e977de794b13584fa66ff32c1
This commit is contained in:
Kyle Jones
2015-03-31 12:16:36 -07:00
committed by Wouter van Oortmerssen
parent 803f9bba27
commit c4a3e2f6bd
2 changed files with 17 additions and 2 deletions

View File

@@ -198,7 +198,7 @@ func (b *Builder) Prep(size, additionalBytes int) {
alignSize &= (size - 1)
// Reallocate the buffer if needed:
for int(b.head) < alignSize+size+additionalBytes {
for int(b.head) <= alignSize+size+additionalBytes {
oldBufSize := len(b.Bytes)
b.growByteBuffer()
b.head += UOffsetT(len(b.Bytes) - oldBufSize)