Allocate memory for block buffer.
This commit is contained in:
parent
9c2726b09c
commit
69ed6efcb2
|
@ -51,7 +51,7 @@ describe('Basic Functionality', function() {
|
|||
var block = bitcore.Block.fromString(data);
|
||||
it('block ' + block.hash, function(done) {
|
||||
bitcoind.getBlock(block.hash, function(err, response) {
|
||||
assert(response === data, 'incorrect block data for ' + block.hash);
|
||||
assert(response.toString('hex') === data, 'incorrect block data for ' + block.hash);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -869,7 +869,7 @@ async_get_block(uv_work_t *req) {
|
|||
fread(&size, sizeof(uint32_t), 1, blockFile);
|
||||
|
||||
// Read block
|
||||
char buffer[size];
|
||||
char* buffer = (char *)malloc(sizeof(char) * size);
|
||||
fread((void *)buffer, sizeof(char), size, blockFile);
|
||||
fclose(blockFile);
|
||||
|
||||
|
|
Loading…
Reference in New Issue