summaryrefslogtreecommitdiffstats
path: root/monop/cards.c
diff options
context:
space:
mode:
authorjsm <jsm@NetBSD.org>1999-09-09 17:27:58 +0000
committerjsm <jsm@NetBSD.org>1999-09-09 17:27:58 +0000
commit05028c2aa439ddb8c5624303ab13b755c79e3930 (patch)
tree4dbfd0bd9517b044c230067c63c13f98608d7599 /monop/cards.c
parent73294a12acd4e9ce3be5c49adc331ab62d3a398f (diff)
downloadbsdgames-darwin-05028c2aa439ddb8c5624303ab13b755c79e3930.tar.gz
bsdgames-darwin-05028c2aa439ddb8c5624303ab13b755c79e3930.tar.zst
bsdgames-darwin-05028c2aa439ddb8c5624303ab13b755c79e3930.zip
Check for failure of malloc() and calloc() at various places in the games.
Diffstat (limited to 'monop/cards.c')
-rw-r--r--monop/cards.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/monop/cards.c b/monop/cards.c
index 079cc236..1b330db7 100644
--- a/monop/cards.c
+++ b/monop/cards.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cards.c,v 1.9 1999/09/08 21:57:18 jsm Exp $ */
+/* $NetBSD: cards.c,v 1.10 1999/09/09 17:27:58 jsm Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)cards.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: cards.c,v 1.9 1999/09/08 21:57:18 jsm Exp $");
+__RCSID("$NetBSD: cards.c,v 1.10 1999/09/09 17:27:58 jsm Exp $");
#endif
#endif /* not lint */
@@ -102,6 +102,8 @@ set_up(dp)
int i;
dp->offsets = (off_t *) calloc(sizeof (off_t), dp->num_cards);
+ if (dp->offsets == NULL)
+ errx(1, "out of memory");
if (fread(dp->offsets, sizeof(off_t), dp->num_cards, deckf) !=
dp->num_cards) {
perror(cardfile);