From 0255deb434f0b1febb9e3be749fae84823faff4c Mon Sep 17 00:00:00 2001 From: christos Date: Sun, 19 Mar 2006 00:32:18 +0000 Subject: [PATCH] Coverity CID 999: Prevent NULL deref. --- games/larn/monster.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/games/larn/monster.c b/games/larn/monster.c index 7d5dd4b9a97c..eb80a9e8ccd5 100644 --- a/games/larn/monster.c +++ b/games/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 #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 @@ -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;