Skip to content

Commit

Permalink
net/proxy/ares:resolver fix a leak
Browse files Browse the repository at this point in the history
  • Loading branch information
iceboy233 committed Jan 3, 2023
1 parent 51cebb2 commit 71468ec
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions net/proxy/ares/resolver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,11 @@ void Resolver::Operation::finish(
for (auto &callback : callbacks) {
std::move(callback)(operation->ec_, operation->addresses_);
}
if (!operation->ec_) {
operation->cache();
if (operation->ec_) {
delete operation;
return;
}
operation->cache();
}

void Resolver::Operation::parse(int status, ares_addrinfo *ai) {
Expand Down

0 comments on commit 71468ec

Please sign in to comment.