Skip to contentSkip to conversation

Use xcalloc instead of calloc

PATCH New Jonas Fonseca 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Use xcalloc instead of calloc

---
 object-refs.c |    2 +-
 object.c      |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
object-refs.c +1 -1
index b1b8065..b0034e4 100644
@@ -30,7 +30,7 @@ static void grow_refs_hash(void)
 	int new_hash_size = (refs_hash_size + 1000) * 3 / 2;
 	struct object_refs **new_hash;
 
-	new_hash = calloc(new_hash_size, sizeof(struct object_refs *));
+	new_hash = xcalloc(new_hash_size, sizeof(struct object_refs *));
 	for (i = 0; i < refs_hash_size; i++) {
 		struct object_refs *ref = refs_hash[i];
 		if (!ref)
object.c +1 -1
index 60bf16b..9281300 100644
@@ -73,7 +73,7 @@ static void grow_object_hash(void)
 	int new_hash_size = obj_hash_size < 32 ? 32 : 2 * obj_hash_size;
 	struct object **new_hash;
 
-	new_hash = calloc(new_hash_size, sizeof(struct object *));
+	new_hash = xcalloc(new_hash_size, sizeof(struct object *));
 	for (i = 0; i < obj_hash_size; i++) {
 		struct object *obj = obj_hash[i];
 		if (!obj)
Signature · 4 lines
1.4.2.g2f76-dirty

-- 
Jonas Fonseca