From 891915e05073ca228f54d00a46f57eb0821c348e Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Sun, 5 May 2024 04:18:44 +0200 Subject: More usage of reallocarray() --- FICS/gameproc.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/FICS/gameproc.c b/FICS/gameproc.c index 0969e60..8dc82f6 100644 --- a/FICS/gameproc.c +++ b/FICS/gameproc.c @@ -631,12 +631,20 @@ process_move(int p, char *command) if (!garray[g].moveList) { garray[g].moveList = - rmalloc(sizeof(move_t) * + reallocarray(NULL, + sizeof(move_t), garray[g].moveListSize); + if (garray[g].moveList == NULL) + err(1, "%s: reallocarray", __func__); + else + malloc_count++; } else { garray[g].moveList = - rrealloc(garray[g].moveList, - (sizeof(move_t) * garray[g].moveListSize)); + reallocarray(garray[g].moveList, + sizeof(move_t), + garray[g].moveListSize); + if (garray[g].moveList == NULL) + err(1, "%s: reallocarray", __func__); } } -- cgit v1.2.3