From: Guus Sliepen Date: Mon, 2 Oct 2017 18:54:57 +0000 (+0200) Subject: Fix a potential memory leak. X-Git-Tag: release-1.0.33~31 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=94dc60fd226dbe5c6c89a5181c066ea8f87cdee2;p=oweals%2Ftinc.git Fix a potential memory leak. Found by the Clang static analyzer. --- 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) {