diff options
author | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-18 08:50:37 +0000 |
---|---|---|
committer | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-18 08:50:37 +0000 |
commit | 4d65e9320ab33a5a1291ab4c3c2fedae6f4bb80d (patch) | |
tree | 6f7b9a2a75de52bbaf7c05ce1d9cb035efcf3be4 /net | |
parent | c2caa398c9f702e70de0ef42577fe455a876739b (diff) | |
download | chromium_src-4d65e9320ab33a5a1291ab4c3c2fedae6f4bb80d.zip chromium_src-4d65e9320ab33a5a1291ab4c3c2fedae6f4bb80d.tar.gz chromium_src-4d65e9320ab33a5a1291ab4c3c2fedae6f4bb80d.tar.bz2 |
Use new char[] to match the delete[]. To fix a valgrind error.
BUG=http://crbug.com/17169
TBR=willchan
TEST=SOCKS5 unit test under valgrind.
Review URL: http://codereview.chromium.org/159052
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21055 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/base/address_list.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/net/base/address_list.cc b/net/base/address_list.cc index 7cfab3f..7a18f04 100644 --- a/net/base/address_list.cc +++ b/net/base/address_list.cc @@ -134,12 +134,13 @@ AddressList AddressList::CreateIPv6Address(unsigned char data[16]) { ai->ai_family = AF_INET6; ai->ai_socktype = SOCK_STREAM; - ai->ai_addrlen = sizeof(sockaddr_in6); + ai->ai_addrlen = sizeof(struct sockaddr_in6); - struct sockaddr_in6* addr6 = new sockaddr_in6; - memset(addr6, 0, sizeof(sockaddr_in6)); + struct sockaddr_in6* addr6 = reinterpret_cast<struct sockaddr_in6*>( + new char[ai->ai_addrlen]); + memset(addr6, 0, sizeof(struct sockaddr_in6)); - ai->ai_addr = reinterpret_cast<sockaddr*>(addr6); + ai->ai_addr = reinterpret_cast<struct sockaddr*>(addr6); addr6->sin6_family = AF_INET6; memcpy(&addr6->sin6_addr, data, 16); |