diff options
author | christos <christos@NetBSD.org> | 2006-03-19 00:32:18 +0000 |
---|---|---|
committer | christos <christos@NetBSD.org> | 2006-03-19 00:32:18 +0000 |
commit | 090a8a4772320cdab74b83318589416ad190514d (patch) | |
tree | 9dc9bc108a3bd67cdfd642638e37171c47537c90 /larn | |
parent | 6a1b3c3645bb800749f068acb8453f1b6c257b83 (diff) | |
download | bsdgames-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.c | 7 |
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; |