From 92caa7fd70b4e1b50bc14be65dfa37336acd37f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96man?= Date: Thu, 21 Feb 2008 21:45:15 +0000 Subject: [PATCH] fix possible NULL deref bug --- spawn.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/spawn.c b/spawn.c index c692c563..139a1e50 100644 --- a/spawn.c +++ b/spawn.c @@ -80,10 +80,11 @@ reaper(void *opaque, int64_t now) } syslog(LOG_INFO, "spawn: \"%s\" %s", s ? s->name : "", txt); - - LIST_REMOVE(s, link); - free((void *)s->name); - free(s); + if(s != NULL) { + LIST_REMOVE(s, link); + free((void *)s->name); + free(s); + } pthread_mutex_unlock(&spawn_mutex); } }