From 83a15a18bd58f12c8139074329b268d3a80ed769 Mon Sep 17 00:00:00 2001
From: aubuxant <aurelien.buxant@student.uclouvain.be>
Date: Wed, 6 May 2020 11:08:43 +0200
Subject: [PATCH] =?UTF-8?q?V=C3=A9rification=20du=20calloc=20dans=20prime?=
 =?UTF-8?q?=5Fdivs?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/main.c b/main.c
index e6b2ebd..c9f2fd0 100644
--- a/main.c
+++ b/main.c
@@ -91,6 +91,7 @@ factor* prime_divs (unsigned long numbr) {
     // Allocation of memory for "struct factor" and initialize to zero
     dividers = (factor *) calloc(1, sizeof(factor));
     //memset(dividers, 0, sizeof(factor)); //To be used with malloc
+    if (dividers == 0) return NULL;
 
     unsigned int n = 0;
     dividers->number = numbr;
-- 
GitLab