Allocate memory for block buffer.

This commit is contained in:
Braydon Fuller 2015-07-09 16:12:38 -04:00
parent 9c2726b09c
commit 69ed6efcb2
2 changed files with 2 additions and 2 deletions

View File

@ -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();
});
});

View File

@ -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);