diff options
author | jsm <jsm@NetBSD.org> | 1999-09-09 17:27:58 +0000 |
---|---|---|
committer | jsm <jsm@NetBSD.org> | 1999-09-09 17:27:58 +0000 |
commit | 05028c2aa439ddb8c5624303ab13b755c79e3930 (patch) | |
tree | 4dbfd0bd9517b044c230067c63c13f98608d7599 /rogue | |
parent | 73294a12acd4e9ce3be5c49adc331ab62d3a398f (diff) | |
download | bsdgames-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 'rogue')
-rw-r--r-- | rogue/init.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/rogue/init.c b/rogue/init.c index c410eba3..f06ca3b4 100644 --- a/rogue/init.c +++ b/rogue/init.c @@ -1,4 +1,4 @@ -/* $NetBSD: init.c,v 1.8 1999/09/08 21:45:30 jsm Exp $ */ +/* $NetBSD: init.c,v 1.9 1999/09/09 17:27:59 jsm Exp $ */ /* * Copyright (c) 1988, 1993 @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: init.c,v 1.8 1999/09/08 21:45:30 jsm Exp $"); +__RCSID("$NetBSD: init.c,v 1.9 1999/09/09 17:27:59 jsm Exp $"); #endif #endif /* not lint */ @@ -332,6 +332,8 @@ env_get_value(s, e, add_blank) } } *s = md_malloc(MAX_OPT_LEN + 2); + if (*s == NULL) + clean_up("out of memory"); (void) strncpy(*s, t, i); if (add_blank) { (*s)[i++] = ' '; @@ -346,6 +348,8 @@ init_str(str, dflt) { if (!(*str)) { *str = md_malloc(MAX_OPT_LEN + 2); + if (*str == NULL) + clean_up("out of memory"); (void) strcpy(*str, dflt); } } |