Browse Source

Fix leak of data when streaming JPEG

v1.x
Linus Unnebäck 9 years ago
parent
commit
ba7422a1ed
No known key found for this signature in database GPG Key ID: F23BD23774478D34
  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