Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/games/backgammon/common_source This adds a check for memory ...



details:   https://anonhg.NetBSD.org/src/rev/eb75c40562f1
branches:  trunk
changeset: 474926:eb75c40562f1
user:      hubertf <hubertf%NetBSD.org@localhost>
date:      Mon Jul 26 18:39:06 1999 +0000

description:
This adds a check for memory allocation failure to one place in
backgammon(6).  The use of write(2) for the message may seem odd, but
is used in another place in this game.  (Actually, a lot of
backgammon(6) could do with being substantially cleaned up.)

Patch submitted in PR 8080 by Joseph Myers <jsm28%cam.ac.uk@localhost>

diffstat:

 games/backgammon/common_source/fancy.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r 20777a6e9bb7 -r eb75c40562f1 games/backgammon/common_source/fancy.c
--- a/games/backgammon/common_source/fancy.c    Mon Jul 26 14:40:34 1999 +0000
+++ b/games/backgammon/common_source/fancy.c    Mon Jul 26 18:39:06 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fancy.c,v 1.9 1999/02/10 17:08:06 hubertf Exp $        */
+/*     $NetBSD: fancy.c,v 1.10 1999/07/26 18:39:06 hubertf Exp $       */
 
 /*
  * Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)fancy.c    8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: fancy.c,v 1.9 1999/02/10 17:08:06 hubertf Exp $");
+__RCSID("$NetBSD: fancy.c,v 1.10 1999/07/26 18:39:06 hubertf Exp $");
 #endif
 #endif /* not lint */
 
@@ -733,5 +733,9 @@
        if (LI < 24 || CO < 72 || !(CL && UP && ND))
                return (0);
        linect = (int *) calloc(LI + 1, sizeof(int));
+       if (linect == NULL) {
+               write(2, "\r\nOut of memory!\r\n", 18);
+               getout(0);
+       }
        return (1);
 }



Home | Main Index | Thread Index | Old Index