buffer: FreeCallback should be tied to ArrayBuffer
authorFedor Indutny <fedor@indutny.com>
Tue, 6 Oct 2015 03:26:13 +0000 (23:26 -0400)
committerJames M Snell <jasnell@gmail.com>
Thu, 8 Oct 2015 03:39:17 +0000 (20:39 -0700)
commit660f7591c80f5a7df6d639c49cba24476329e001
treeebab2a2d1b65a62a979ab47b8923dd19e5fedd15
parent70c9e4337e032d4d9334725cb280d5674293b764
buffer: FreeCallback should be tied to ArrayBuffer

FreeCallback should be invoked on the storage disposal (`ArrayBuffer`),
not when the view (`Uint8Array` or `Buffer`) is disposed. This causes
bug and crashes in addons which create buffers and store only slices of
them.

PR-URL: https://github.com/nodejs/node/pull/3198
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
src/node_buffer.cc
test/addons/buffer-free-callback/binding.cc [new file with mode: 0644]
test/addons/buffer-free-callback/binding.gyp [new file with mode: 0644]
test/addons/buffer-free-callback/test.js [new file with mode: 0644]