From 94dc60fd226dbe5c6c89a5181c066ea8f87cdee2 Mon Sep 17 00:00:00 2001
From: Guus Sliepen <guus@tinc-vpn.org>
Date: Mon, 2 Oct 2017 20:54:57 +0200
Subject: [PATCH] Fix a potential memory leak.

Found by the Clang static analyzer.
---
 src/meta.c             | 5 -----
 src/multicast_device.c | 4 +++-
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/meta.c b/src/meta.c
index ccc3b2e..60814c7 100644
--- a/src/meta.c
+++ b/src/meta.c
@@ -38,11 +38,6 @@ bool send_meta(connection_t *c, const char *buffer, int length) {
 	int outlen;
 	int result;
 
-	if(!c) {
-		logger(LOG_ERR, "send_meta() called with NULL pointer!");
-		abort();
-	}
-
 	ifdebug(META) logger(LOG_DEBUG, "Sending %d bytes of metadata to %s (%s)", length,
 			   c->name, c->hostname);
 
diff --git a/src/multicast_device.c b/src/multicast_device.c
index ea43e2c..ceaa3ef 100644
--- a/src/multicast_device.c
+++ b/src/multicast_device.c
@@ -70,8 +70,10 @@ static bool setup_device(void) {
 	}
 
 	ai = str2addrinfo(host, port, SOCK_DGRAM);
-	if(!ai)
+	if(!ai) {
+		free(host);
 		return false;
+	}
 
 	device_fd = socket(ai->ai_family, SOCK_DGRAM, IPPROTO_UDP);
 	if(device_fd < 0) {
-- 
2.25.1