From 9744a48a6733e6d9c069943b603490df769bbc00 Mon Sep 17 00:00:00 2001 From: Celine Mercier Date: Sun, 20 Aug 2017 17:25:15 +0200 Subject: [PATCH] BUG FIX: seemingly identical obiblobs would have different hash values because of the padding added by the compiler. Fixed by using calloc instead of malloc for obiblob memory allocation. --- src/obiblob.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/obiblob.c b/src/obiblob.c index 1547770..66a5c9c 100644 --- a/src/obiblob.c +++ b/src/obiblob.c @@ -32,7 +32,7 @@ Obi_blob_p obi_blob(byte_t* encoded_value, uint8_t element_size, int32_t length_ Obi_blob_p blob; // Allocate the memory for the blob structure - blob = (Obi_blob_p) malloc(sizeof(Obi_blob_t) + length_encoded_value); + blob = (Obi_blob_p) calloc(sizeof(Obi_blob_t) + length_encoded_value, sizeof(byte_t)); if (blob == NULL) { obi_set_errno(OBI_MALLOC_ERROR);