From 91004a24a934a58194b8c16737021d2163a38f90 Mon Sep 17 00:00:00 2001 From: Braydon Fuller Date: Thu, 9 Jul 2015 17:34:37 -0400 Subject: [PATCH] Free block buffer memory. --- integration/index.js | 18 ++++++++++++++++++ src/bitcoindjs.cc | 3 +++ 2 files changed, 21 insertions(+) diff --git a/integration/index.js b/integration/index.js index f7cbe53c..10758fa5 100644 --- a/integration/index.js +++ b/integration/index.js @@ -78,4 +78,22 @@ describe('Basic Functionality', function() { }); }); + describe.skip('get the chain', function() { + + var heights = []; + for (var i = 364599; i >= 0 ; i--) { + heights.push(i); + } + + heights.forEach(function(height) { + it('block at height ' + height, function(done) { + bitcoind.getBlock(height, function(err, response) { + var block = bitcore.Block.fromBuffer(response); + console.log(block.hash); + done(); + }); + }); + }); + }); + }); diff --git a/src/bitcoindjs.cc b/src/bitcoindjs.cc index a62f3d06..28599bad 100644 --- a/src/bitcoindjs.cc +++ b/src/bitcoindjs.cc @@ -906,6 +906,9 @@ async_get_block_after(uv_work_t *req) { Local rawNodeBuffer = node::Buffer::New(isolate, data->buffer, data->size); + delete data->buffer; + data->buffer = NULL; + const unsigned argc = 2; Local argv[argc] = { Local::New(isolate, NanNull()),