From 77425c1a1afd89f17171281665ccbf0172b3da42 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Tue, 8 Dec 2015 11:56:09 +0100 Subject: [PATCH] email plugin: Free "connection" in error handling. CID: 38010 --- src/email.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/email.c b/src/email.c index fdcf0677..7493cc6d 100644 --- a/src/email.c +++ b/src/email.c @@ -520,13 +520,20 @@ static void *open_connection (void __attribute__((unused)) *arg) } } while (EINTR == errno); - connection = (conn_t *)smalloc (sizeof (conn_t)); + connection = malloc (sizeof (*connection)); + if (connection != NULL) + { + close (remote); + continue; + } + memset (connection, 0, sizeof (*connection)); connection->socket = fdopen (remote, "r"); connection->next = NULL; if (NULL == connection->socket) { close (remote); + sfree (connection); continue; } -- 2.11.0