summaryrefslogtreecommitdiffstats
path: root/monop
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2006-03-19 00:03:18 +0000
committerchristos <christos@NetBSD.org>2006-03-19 00:03:18 +0000
commit453445f50b578244b2df32ce60b9a30543a72612 (patch)
treeb70a54130986a063484912bb89d29e88dcd0d124 /monop
parentb284b24896a2f0f173af4cffd241244a540cd407 (diff)
downloadbsdgames-darwin-453445f50b578244b2df32ce60b9a30543a72612.tar.gz
bsdgames-darwin-453445f50b578244b2df32ce60b9a30543a72612.tar.zst
bsdgames-darwin-453445f50b578244b2df32ce60b9a30543a72612.zip
Coverity CID 1005: Fix NULL deref and incorrect variable use.
Diffstat (limited to 'monop')
-rw-r--r--monop/misc.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/monop/misc.c b/monop/misc.c
index 1d3a5669..df444988 100644
--- a/monop/misc.c
+++ b/monop/misc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: misc.c,v 1.13 2004/11/05 21:30:32 dsl Exp $ */
+/* $NetBSD: misc.c,v 1.14 2006/03/19 00:03:18 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: misc.c,v 1.13 2004/11/05 21:30:32 dsl Exp $");
+__RCSID("$NetBSD: misc.c,v 1.14 2006/03/19 00:03:18 christos Exp $");
#endif
#endif /* not lint */
@@ -201,16 +201,21 @@ set_ownlist(pl)
printf("player # %d\n", pl+1);
printhold(pl);
printf("orig_op = %p\n", orig_op);
- printf("orig_op->sqr->type = %d (PRPTY)\n",
- op->sqr->type);
- printf("orig_op->next = %p\n", op->next);
- printf("orig_op->sqr->desc = %p\n",
- op->sqr->desc);
+ if (orig_op) {
+ printf("orig_op->sqr->type = %d (PRPTY)\n",
+ orig_op->sqr->type);
+ printf("orig_op->next = %p\n", op->next);
+ printf("orig_op->sqr->desc = %p\n",
+ orig_op->sqr->desc);
+ }
printf("op = %p\n", op);
- printf("op->sqr->type = %d (PRPTY)\n",
- op->sqr->type);
- printf("op->next = %p\n", op->next);
- printf("op->sqr->desc = %p\n", op->sqr->desc);
+ if (op) {
+ printf("op->sqr->type = %d (PRPTY)\n",
+ op->sqr->type);
+ printf("op->next = %p\n", op->next);
+ printf("op->sqr->desc = %p\n",
+ op->sqr->desc);
+ }
printf("num = %d\n", num);
}
#ifdef DEBUG