mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-23 10:54:33 +00:00
Bug 1183781 - Fix leak in nsHostResolver r=sworkman
This commit is contained in:
parent
b792a1d804
commit
94743edaf7
@ -471,6 +471,15 @@ HostDB_ClearEntry(PLDHashTable *table,
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
{
|
||||
MutexAutoLock lock(he->rec->addr_info_lock);
|
||||
if (he->rec->addr_info) {
|
||||
delete hr->addr_info;
|
||||
he->rec->addr_info = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
NS_RELEASE(he->rec);
|
||||
}
|
||||
|
||||
@ -853,8 +862,12 @@ nsHostResolver::ResolveHost(const char *host,
|
||||
LOG((" Trying AF_UNSPEC entry for host [%s%s%s] af: %s.\n",
|
||||
LOG_HOST(host, netInterface),
|
||||
(af == PR_AF_INET) ? "AF_INET" : "AF_INET6"));
|
||||
|
||||
he->rec->addr_info = nullptr;
|
||||
// Ensure existing `addr_info` in `he` is cleared before
|
||||
// copying from `unSpecHe`.
|
||||
if (he->rec->addr_info) {
|
||||
delete he->rec->addr_info;
|
||||
he->rec->addr_info = nullptr;
|
||||
}
|
||||
if (unspecHe->rec->negative) {
|
||||
he->rec->negative = unspecHe->rec->negative;
|
||||
he->rec->CopyExpirationTimesAndFlagsFrom(unspecHe->rec);
|
||||
|
Loading…
x
Reference in New Issue
Block a user