Merge branch 'cm/reftable-0-length-memset'
Code clean-up. * cm/reftable-0-length-memset: reftable: avoid undefined behaviour breaking t0032
This commit is contained in:
commit
1c4411cce1
@ -15,6 +15,7 @@ https://developers.google.com/open-source/licenses/bsd
|
||||
|
||||
static void strbuf_return_block(void *b, struct reftable_block *dest)
|
||||
{
|
||||
if (dest->len)
|
||||
memset(dest->data, 0xff, dest->len);
|
||||
reftable_free(dest->data);
|
||||
}
|
||||
@ -56,6 +57,7 @@ void block_source_from_strbuf(struct reftable_block_source *bs,
|
||||
|
||||
static void malloc_return_block(void *b, struct reftable_block *dest)
|
||||
{
|
||||
if (dest->len)
|
||||
memset(dest->data, 0xff, dest->len);
|
||||
reftable_free(dest->data);
|
||||
}
|
||||
@ -85,6 +87,7 @@ static uint64_t file_size(void *b)
|
||||
|
||||
static void file_return_block(void *b, struct reftable_block *dest)
|
||||
{
|
||||
if (dest->len)
|
||||
memset(dest->data, 0xff, dest->len);
|
||||
reftable_free(dest->data);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user