GitHub user davisp opened a pull request:
https://github.com/apache/couchdb-snappy/pull/9
Fix memory bug in SnappyNifSink::Append
Previously `SnappyNifSink` assumed that `GetAppendBuffer` was always
called before `Append`. This turned out to be an invalid assumption.
This was definitely in the land of "How did that even work?". The simple
fix is simple.
This also pre-allocates the write buffer to 8192 bytes which just saves
us from the initial re-allocation on first `Append` since we allocated a
zero length buffer initially.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/cloudant/couchdb-snappy fix-sink-buffer
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/couchdb-snappy/pull/9.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #9
----
commit 60572a1a4a9fe3cf4e97ccf14df100080481791a
Author: Paul J. Davis <paul.joseph.davis@...>
Date: 2018-10-16T15:51:18Z
Normalize capitalization
commit 2038ad13b1d6926468f25adea110028e3c0b4b0c
Author: Paul J. Davis <paul.joseph.davis@...>
Date: 2018-10-16T16:07:58Z
Fix memory bug in SnappyNifSink::Append
Previously `SnappyNifSink` assumed that `GetAppendBuffer` was always
called before `Append`. This turned out to be an invalid assumption.
This was definitely in the land of "How did that even work?". The simple
fix is simple.
This also pre-allocates the write buffer to 8192 bytes which just saves
us from the initial re-allocation on first `Append` since we allocated a
zero length buffer initially.
----
---