From: Yao Zongyou Date: Sat, 23 Dec 2017 04:48:47 +0000 (+0800) Subject: common/dns_resolve: fix memory leak X-Git-Tag: v13.0.2~671^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F19649%2Fhead;p=ceph.git common/dns_resolve: fix memory leak Signed-off-by: Yao Zongyou --- diff --git a/src/common/dns_resolve.cc b/src/common/dns_resolve.cc index f3594b0041f7..351e390f9e3e 100644 --- a/src/common/dns_resolve.cc +++ b/src/common/dns_resolve.cc @@ -196,6 +196,9 @@ int DNSResolver::resolve_ip_addr(CephContext *cct, const string& hostname, if (r < 0) { return r; } + auto put_state = make_scope_guard([res, this] { + this->put_state(res); + }); return this->resolve_ip_addr(cct, &res, hostname, addr); #else return this->resolve_ip_addr(cct, NULL, hostname, addr);