Unit testing and memory fixes

This commit is contained in:
John Jones 2017-07-26 09:48:04 -05:00
parent 692d3406c8
commit 10aa932e08
15 changed files with 256 additions and 75 deletions

View file

@ -134,7 +134,8 @@ int ipfs_blocks_block_add_data(const unsigned char* data, size_t data_size, stru
return 0;
}
if (ipfs_cid_new(0, hash, 32, CID_PROTOBUF, &(block->cid)) == 0) {
block->cid = ipfs_cid_new(0, hash, 32, CID_PROTOBUF);
if (block->cid == NULL) {
return 0;
}

View file

@ -127,7 +127,7 @@ int ipfs_blockstore_get(const struct BlockstoreContext* context, struct Cid* cid
int retVal = ipfs_blocks_block_protobuf_decode(buffer, bytes_read, block);
(*block)->cid = cid;
(*block)->cid = ipfs_cid_copy(cid);
free(key);
free(filename);