Browse Source

Merge pull request #774 from LinusU/fix-data-leak

Fix leak of data when streaming JPEG
v1.x
Linus Unnebäck 9 years ago
parent
commit
604ba0922a
  1. 2
      src/JPEGStream.h
  2. 2
      test/canvas.test.js

2
src/JPEGStream.h

@ -53,7 +53,7 @@ term_closure_destination(j_compress_ptr cinfo){
closure_destination_mgr *dest = (closure_destination_mgr *) cinfo->dest;
/* emit remaining data */
Local<Object> buf = Nan::NewBuffer((char *)dest->buffer, dest->bufsize).ToLocalChecked();
Local<Object> buf = Nan::NewBuffer((char *)dest->buffer, dest->bufsize - dest->pub.free_in_buffer).ToLocalChecked();
Local<Value> data_argv[2] = {
Nan::Null()

2
test/canvas.test.js

@ -817,7 +817,7 @@ describe('Canvas', function () {
bytes += chunk.length;
});
stream.on('end', function(){
assert.equal(bytes, 8192);
assert.equal(bytes, 5427);
done();
});
stream.on('error', function(err) {

Loading…
Cancel
Save