libmowgli: fix memory leak

This commit is contained in:
Nathan Owens 2018-12-31 22:04:29 -06:00 committed by maxice8
parent 8df6525b74
commit 7b980e56b2
2 changed files with 30 additions and 2 deletions

View file

@ -0,0 +1,28 @@
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
--- src/libmowgli/dns/evloop_res.c
+++ 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;
}

View file

@ -1,15 +1,15 @@
# Template file for 'libmowgli'
pkgname=libmowgli
version=2.1.3
revision=4
revision=5
wrksrc="${pkgname}-2-${version}"
build_style=gnu-configure
hostmakedepends="pkg-config"
makedepends="libressl-devel"
short_desc="Performance and usability-oriented extensions to C"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
homepage="https://github.com/atheme/libmowgli-2"
license="MIT"
homepage="https://github.com/atheme/libmowgli-2"
distfiles="https://github.com/atheme/libmowgli-2/archive/v${version}.tar.gz"
checksum=b7faab2fb9f46366a52b51443054a2ed4ecdd04774c65754bf807c5e9bdda477