From 9ff8f5da48f2602881d64ab6a1c3e38f929bc418 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sun, 5 Sep 2010 09:42:40 +0200 Subject: [PATCH] notify_email plugin: Check for "session == NULL" and return gracefully. I don't know how libesmtp handles NULL pointers and I don't want to take my chances. --- src/notify_email.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/notify_email.c b/src/notify_email.c index 10d5ab1b..0aed27f1 100644 --- a/src/notify_email.c +++ b/src/notify_email.c @@ -272,6 +272,12 @@ static int notify_email_notification (const notification_t *n, pthread_mutex_lock (&session_lock); + if (session == NULL) { + /* Initialization failed or we're in the process of shutting down. */ + pthread_mutex_unlock (&session_lock); + return (-1); + } + if (!(message = smtp_add_message (session))) { pthread_mutex_unlock (&session_lock); ERROR ("notify_email plugin: cannot set SMTP message"); -- 2.30.2