summaryrefslogtreecommitdiffstats
path: root/larn
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2006-03-19 00:32:18 +0000
committerchristos <christos@NetBSD.org>2006-03-19 00:32:18 +0000
commit090a8a4772320cdab74b83318589416ad190514d (patch)
tree9dc9bc108a3bd67cdfd642638e37171c47537c90 /larn
parent6a1b3c3645bb800749f068acb8453f1b6c257b83 (diff)
downloadbsdgames-darwin-090a8a4772320cdab74b83318589416ad190514d.tar.gz
bsdgames-darwin-090a8a4772320cdab74b83318589416ad190514d.tar.zst
bsdgames-darwin-090a8a4772320cdab74b83318589416ad190514d.zip
Coverity CID 999: Prevent NULL deref.
Diffstat (limited to 'larn')
-rw-r--r--larn/monster.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/larn/monster.c b/larn/monster.c
index 7d5dd4b9..eb80a9e8 100644
--- a/larn/monster.c
+++ b/larn/monster.c
@@ -1,4 +1,4 @@
-/* $NetBSD: monster.c,v 1.8 2004/01/27 20:30:30 jsm Exp $ */
+/* $NetBSD: monster.c,v 1.9 2006/03/19 00:32:18 christos Exp $ */
/*
* monster.c Larn is copyrighted 1986 by Noah Morgan.
@@ -100,7 +100,7 @@
*/
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: monster.c,v 1.8 2004/01/27 20:30:30 jsm Exp $");
+__RCSID("$NetBSD: monster.c,v 1.9 2006/03/19 00:32:18 christos Exp $");
#endif /* not lint */
#include <string.h>
@@ -1846,7 +1846,8 @@ rmsphere(x, y)
spheres = sp->p;
free((char *) sp2);
} else {
- sp2->p = sp->p;
+ if (sp2)
+ sp2->p = sp->p;
free((char *) sp);
}
break;