Bug 1420677 - Make sure to update addr_info_gencnt each time we change addr_info r=dragana

When changing addr_info we didn't always update addr_info_gencnt, so when it the old AddrInfo was freed, even though we lock in nsDNSRecord::GetNextAddr, mIter would still point to the old AddrInfo.

Differential Revision: https://phabricator.services.mozilla.com/D23923

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Valentin Gosu 2019-03-19 12:21:07 +00:00
Родитель a2d6b63946
Коммит 599df523e1
1 изменённых файлов: 2 добавлений и 0 удалений

Просмотреть файл

@ -1009,6 +1009,7 @@ nsresult nsHostResolver::ResolveHost(const nsACString &aHost, uint16_t type,
MutexAutoLock lock(addrRec->addr_info_lock);
addrRec->addr_info = nullptr;
addrRec->addr_info_gencnt++;
if (unspecRec->negative) {
rec->negative = unspecRec->negative;
rec->CopyExpirationTimesAndFlagsFrom(unspecRec);
@ -1026,6 +1027,7 @@ nsresult nsHostResolver::ResolveHost(const nsACString &aHost, uint16_t type,
new AddrInfo(addrUnspecRec->addr_info->mHostName,
addrUnspecRec->addr_info->mCanonicalName,
addrUnspecRec->addr_info->IsTRR());
addrRec->addr_info_gencnt++;
rec->CopyExpirationTimesAndFlagsFrom(unspecRec);
}
addrRec->addr_info->AddAddress(new NetAddrElement(*addrIter));