usr: busybox: syslogd: Fix segmentation fault

Fix the segmentation fault observed when spawning syslogd on the
router in foreground using -n command line option and then
abruptly stop the syslogd process with 'ctrl+c'.

Change-Id: Ib71916fe39dfd868174c511e65d66afa7045c4dc
diff --git a/sysklogd/tls.c b/sysklogd/tls.c
index bbb5c38..8ceaa66 100644
--- a/sysklogd/tls.c
+++ b/sysklogd/tls.c
@@ -130,9 +130,13 @@
 
 void close_connection(SSL *ssl, int server_fd, SSL_CTX *ctx)
 {
-	close(server_fd);
-	SSL_shutdown(ssl);
-	SSL_free(ssl);
-	SSL_CTX_free(ctx);
+	if (server_fd > 0)
+		close(server_fd);
+	if (ssl) {
+		SSL_shutdown(ssl);
+		SSL_free(ssl);
+	}
+	if (ctx)
+		SSL_CTX_free(ctx);
 }
 #endif