aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/makerank.c
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2023-12-13 23:21:10 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2023-12-13 23:21:10 +0100
commitc0b3ada3558c2b427ac3d02c64440a2b3a2683db (patch)
tree7119ff7152b24370b5597efe78eda9c3da8de646 /FICS/makerank.c
parenta22b7878a21732bdde93a5639c16138cfeaa8176 (diff)
Handle malloc() error correctly
Diffstat (limited to 'FICS/makerank.c')
-rw-r--r--FICS/makerank.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/FICS/makerank.c b/FICS/makerank.c
index 90a5c22..dd936fb 100644
--- a/FICS/makerank.c
+++ b/FICS/makerank.c
@@ -125,17 +125,15 @@ LoadEntries(void)
if (GetPlayerInfo(pathInput, &e)) {
if ((list[n] = malloc(sizeof(ENTRY))) ==
- NULL) {
- fprintf(stderr, "malloc() failed!\n");
- } else {
- memcpy(list[n], &e, sizeof(ENTRY));
-
- if (++n == listsize) {
- listsize += 100;
- list = realloc(list,
- listsize *
- sizeof(ENTRY *));
- }
+ NULL)
+ err(1, "%s: malloc", __func__);
+
+ memcpy(list[n], &e, sizeof(ENTRY));
+
+ if (++n == listsize) {
+ listsize += 100;
+ list = realloc(list, listsize *
+ sizeof(ENTRY *));
}
}
}