From 21658b28f1323f11f1aac936b39fb41502c17b8a Mon Sep 17 00:00:00 2001
From: Aaron Jones <aaronmdjones@gmail.com>
Date: Tue, 6 Mar 2018 19:51:04 +0000
Subject: [PATCH] src/libmowgli/dns/evloop_res.c: fix memory leak

mowgli_dns_evloop_init() [called by mowgli_dns_create()] allocates
a random number generator and assigns it to `dns->state->rand', but
mowgli_dns_evloop_destroy() [called by mowgli_dns_destroy()] does
not free this object.

This was found while running Atheme IRC Services (atheme/#621) under
Valgrind.
---
 src/libmowgli/dns/evloop_res.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/libmowgli/dns/evloop_res.c b/src/libmowgli/dns/evloop_res.c
index c8c7775..88757aa 100644
--- a/src/libmowgli/dns/evloop_res.c
+++ b/src/libmowgli/dns/evloop_res.c
@@ -194,6 +194,7 @@ mowgli_dns_evloop_destroy(mowgli_dns_t *dns)
 
 	mowgli_timer_destroy(state->eventloop, state->timeout_resolver_timer);
 
+	mowgli_object_unref(state->rand);
 	mowgli_free(state);
 	dns->dns_state = NULL;
 }
