]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
common/dns_resolve: fix memory leak
authorYao Zongyou <yaozongyou@vip.qq.com>
Sat, 23 Dec 2017 04:48:47 +0000 (12:48 +0800)
committerYao Zongyou <yaozongyou@vip.qq.com>
Sat, 23 Dec 2017 04:48:47 +0000 (12:48 +0800)
Signed-off-by: Yao Zongyou <yaozongyou@vip.qq.com>
src/common/dns_resolve.cc

index f3594b0041f78ece3113a06274d5c9e0572013f9..351e390f9e3efc21652f02d72754127adf6122a6 100644 (file)
@@ -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);