X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Femail.c;h=7493cc6d6967bc07255d7fb91a12bb5a6039974b;hb=77425c1a1afd89f17171281665ccbf0172b3da42;hp=fdcf0677837e25cb27e50e78ad6c69f17be7bc3c;hpb=fa8f55507f7e5626281688fbc87ac4fe8d2dcef6;p=collectd.git 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; }