diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-05-05 15:30:22 +0200 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-05-05 15:30:22 +0200 |
commit | c3484adc5696c68a7988bcd4fc7053f5b7a9506f (patch) | |
tree | 8f33a42d925beaf809f064529562b5e172dc3fd7 /FICS/multicol.c | |
parent | 5fb7e2ad1fb347382894cec0f557c197ae2cf3af (diff) |
Added usage of reallocarray()
Diffstat (limited to 'FICS/multicol.c')
-rw-r--r-- | FICS/multicol.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/FICS/multicol.c b/FICS/multicol.c index 69f33eb..60a4a32 100644 --- a/FICS/multicol.c +++ b/FICS/multicol.c @@ -26,6 +26,8 @@ #include "stdinclude.h" #include "common.h" +#include <err.h> + #include "multicol.h" #include "rmalloc.h" #include "utils.h" @@ -38,7 +40,12 @@ multicol_start(int maxArray) m = rmalloc(sizeof(multicol)); m->arraySize = maxArray; m->num = 0; - m->strArray = rmalloc(sizeof(char *) * m->arraySize); + m->strArray = reallocarray(NULL, sizeof(char *), m->arraySize); + + if (m->strArray == NULL) + err(1, "%s: reallocarray", __func__); + else + malloc_count++; for (int i = 0; i < m->arraySize; i++) m->strArray[i] = NULL; |