Bug 1420677 - Make AddrInfo.mAddresses an AutoCleanLinkedList r=dragana
authorValentin Gosu <valentin.gosu@gmail.com>
Mon, 11 Mar 2019 13:00:35 +0000
changeset 521344 edff1f39d426
parent 521343 f21b07ac7fb7
child 521345 cf114035c79f
push id10866
push usernerli@mozilla.com
push dateTue, 12 Mar 2019 18:59:09 +0000
treeherdermozilla-beta@445c24a51727 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdragana
bugs1420677
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1420677 - Make AddrInfo.mAddresses an AutoCleanLinkedList r=dragana Differential Revision: https://phabricator.services.mozilla.com/D22960
netwerk/dns/DNS.cpp
netwerk/dns/DNS.h
--- a/netwerk/dns/DNS.cpp
+++ b/netwerk/dns/DNS.cpp
@@ -325,20 +325,16 @@ AddrInfo::AddrInfo(const AddrInfo *src) 
 
   for (auto element = src->mAddresses.getFirst(); element;
        element = element->getNext()) {
     AddAddress(new NetAddrElement(*element));
   }
 }
 
 AddrInfo::~AddrInfo() {
-  NetAddrElement *addrElement;
-  while ((addrElement = mAddresses.popLast())) {
-    delete addrElement;
-  }
 }
 
 void AddrInfo::AddAddress(NetAddrElement *address) {
   MOZ_ASSERT(address, "Cannot add the address to an uninitialized list");
 
   mAddresses.insertBack(address);
 }
 
--- a/netwerk/dns/DNS.h
+++ b/netwerk/dns/DNS.h
@@ -144,17 +144,17 @@ class AddrInfo {
 
   size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
 
   nsCString mHostName;
   nsCString mCanonicalName;
   uint32_t ttl;
   static const uint32_t NO_TTL_DATA = (uint32_t)-1;
 
-  LinkedList<NetAddrElement> mAddresses;
+  AutoCleanLinkedList<NetAddrElement> mAddresses;
   unsigned int IsTRR() { return mFromTRR; }
 
  private:
   unsigned int mFromTRR;
 };
 
 // Copies the contents of a PRNetAddr to a NetAddr.
 // Does not do a ptr safety check!