The old loop seemed confusing to me and it overestimated the size of the memory to allocate by a large factor. The old loop would need to have about half of it rewritten to fix the size overestimation and a little more for fixing the original bug. If you think it's very important to keep as much of the old code as possible, I can rewrite the patch that way, but I don't think that's necessary.
Jacob Lifshay

On Feb 7, 2017 7:43 PM, "Vincent Povirk" <madewokherd@gmail.com> wrote:
Is it really necessary to rewrite this loop? It'd be better to fix the
existing code, if possible.