From: Ryan McCabe Date: Wed, 4 Dec 2019 15:33:55 +0000 (-0500) Subject: network: Add missing freeaddrinfo on error path. X-Git-Url: https://git.octo.it/?p=collectd.git;a=commitdiff_plain;h=de407dd4e036f73e9bd4658af9d71f504fc11109 network: Add missing freeaddrinfo on error path. Add a missing freeaddrinfo on an error path to fix a memory leak in the network code. Changelog: network: Fix memory leak. Signed-off-by: Ryan McCabe --- diff --git a/src/network.c b/src/network.c index a1a6e3d0..613caa73 100644 --- a/src/network.c +++ b/src/network.c @@ -2762,6 +2762,7 @@ network_config_set_bind_address(const oconfig_item_t *ci, *bind_address = malloc(sizeof(**bind_address)); if (*bind_address == NULL) { ERROR("network plugin: network_config_set_bind_address: malloc failed."); + freeaddrinfo(res); return -1; } (*bind_address)->ss_family = res->ai_family;