diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-05-05 04:18:44 +0200 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-05-05 04:18:44 +0200 |
commit | 891915e05073ca228f54d00a46f57eb0821c348e (patch) | |
tree | c9ed7e9794b9376f436ddde3196fcdcdb3d630c6 | |
parent | d1b51a595d352e933b59df16f015d42d85943c7e (diff) |
More usage of reallocarray()
-rw-r--r-- | FICS/gameproc.c | 14 |
1 files 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__); } } |