[haiku-commits] Re: haiku: hrev46687 - src/kits/network/libnetapi

  • From: Stephan Aßmus <superstippi@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 16 Jan 2014 17:20:56 +0100

On 16.01.2014 16:56, pulkomandy@xxxxxxxxxxxxx wrote:
@@ -370,7 +389,7 @@ BNetworkCookieJar::operator=(const BNetworkCookieJar& other)
        fFlattened = other.fFlattened;

        delete fCookieHashMap;
-       fCookieHashMap = new PrivateHashMap();
+       fCookieHashMap = new(std::nothrow) PrivateHashMap();

        for (Iterator it = other.GetIterator(); it.HasNext();) {
                BNetworkCookie* cookie = it.Next();

Here you don't check the fCookieHashMap allocation. You should probably do the allocation in the beginning of the function and include failure in the B_NO_MEMORY return which is already there.

Best regards,
-Stephan


Other related posts: