diff options
32 files changed, 100 insertions, 105 deletions
diff --git a/base/debug/stack_trace_posix.cc b/base/debug/stack_trace_posix.cc index d717972..83ca78a 100644 --- a/base/debug/stack_trace_posix.cc +++ b/base/debug/stack_trace_posix.cc @@ -151,7 +151,8 @@ void ProcessBacktrace(void *const *trace, // Below part is async-signal unsafe (uses malloc), so execute it only // when we are not executing the signal handler. if (in_signal_handler == 0) { - scoped_ptr_malloc<char*> trace_symbols(backtrace_symbols(trace, size)); + scoped_ptr<char*, FreeDeleter> + trace_symbols(backtrace_symbols(trace, size)); if (trace_symbols.get()) { for (int i = 0; i < size; ++i) { std::string trace_symbol = trace_symbols.get()[i]; diff --git a/chrome/common/net/x509_certificate_model_nss.cc b/chrome/common/net/x509_certificate_model_nss.cc index 9df20a8..bc0785c 100644 --- a/chrome/common/net/x509_certificate_model_nss.cc +++ b/chrome/common/net/x509_certificate_model_nss.cc @@ -81,13 +81,12 @@ struct NSSCMSMessageDeleter { }; typedef scoped_ptr<NSSCMSMessage, NSSCMSMessageDeleter> ScopedNSSCMSMessage; -class FreeNSSCMSSignedData { - public: +struct FreeNSSCMSSignedData { inline void operator()(NSSCMSSignedData* x) const { NSS_CMSSignedData_Destroy(x); } }; -typedef scoped_ptr_malloc<NSSCMSSignedData, FreeNSSCMSSignedData> +typedef scoped_ptr<NSSCMSSignedData, FreeNSSCMSSignedData> ScopedNSSCMSSignedData; } // namespace diff --git a/content/renderer/pepper/host_var_tracker_unittest.cc b/content/renderer/pepper/host_var_tracker_unittest.cc index 0486805..3fd334b1 100644 --- a/content/renderer/pepper/host_var_tracker_unittest.cc +++ b/content/renderer/pepper/host_var_tracker_unittest.cc @@ -56,8 +56,7 @@ NPObject* NewTrackedNPObject() { return object; } -class ReleaseNPObject { - public: +struct ReleaseNPObject { void operator()(NPObject* o) const { blink::WebBindings::releaseObject(o); } @@ -65,7 +64,7 @@ class ReleaseNPObject { // Handles automatically releasing a reference to the NPObject on destruction. // It's assumed the input has a ref already taken. -typedef scoped_ptr_malloc<NPObject, ReleaseNPObject> NPObjectReleaser; +typedef scoped_ptr<NPObject, ReleaseNPObject> NPObjectReleaser; } // namespace diff --git a/crypto/scoped_capi_types.h b/crypto/scoped_capi_types.h index 16a5192..9ab28d9 100644 --- a/crypto/scoped_capi_types.h +++ b/crypto/scoped_capi_types.h @@ -42,8 +42,8 @@ struct CAPIDestroyerWithFlags { // scoped_ptr-like class for the CryptoAPI cryptography and certificate // handles. Because these handles are defined as integer types, and not -// pointers, the existing scoped classes, such as scoped_ptr_malloc, are -// insufficient. The semantics are the same as scoped_ptr. +// pointers, the existing scoped classes, such as scoped_ptr, are insufficient. +// The semantics are the same as scoped_ptr. template <class CAPIHandle, typename FreeProc> class ScopedCAPIHandle { public: diff --git a/crypto/scoped_nss_types.h b/crypto/scoped_nss_types.h index 21f684f..d5aebc5 100644 --- a/crypto/scoped_nss_types.h +++ b/crypto/scoped_nss_types.h @@ -31,35 +31,30 @@ struct NSSDestroyer1 { }; // Define some convenient scopers around NSS pointers. -typedef scoped_ptr_malloc< - PK11Context, NSSDestroyer1<PK11Context, - PK11_DestroyContext, - PR_TRUE> > ScopedPK11Context; -typedef scoped_ptr_malloc< - PK11SlotInfo, NSSDestroyer<PK11SlotInfo, PK11_FreeSlot> > ScopedPK11Slot; -typedef scoped_ptr_malloc< - PK11SlotList, NSSDestroyer<PK11SlotList, - PK11_FreeSlotList> > ScopedPK11SlotList; -typedef scoped_ptr_malloc< - PK11SymKey, NSSDestroyer<PK11SymKey, PK11_FreeSymKey> > ScopedPK11SymKey; -typedef scoped_ptr_malloc< - SECKEYPublicKey, NSSDestroyer<SECKEYPublicKey, SECKEY_DestroyPublicKey> > +typedef scoped_ptr<PK11Context, + NSSDestroyer1<PK11Context, PK11_DestroyContext, PR_TRUE> > + ScopedPK11Context; +typedef scoped_ptr<PK11SlotInfo, NSSDestroyer<PK11SlotInfo, PK11_FreeSlot> > + ScopedPK11Slot; +typedef scoped_ptr<PK11SlotList, NSSDestroyer<PK11SlotList, PK11_FreeSlotList> > + ScopedPK11SlotList; +typedef scoped_ptr<PK11SymKey, NSSDestroyer<PK11SymKey, PK11_FreeSymKey> > + ScopedPK11SymKey; +typedef scoped_ptr<SECKEYPublicKey, + NSSDestroyer<SECKEYPublicKey, SECKEY_DestroyPublicKey> > ScopedSECKEYPublicKey; -typedef scoped_ptr_malloc< - SECKEYPrivateKey, NSSDestroyer<SECKEYPrivateKey, SECKEY_DestroyPrivateKey> > +typedef scoped_ptr<SECKEYPrivateKey, + NSSDestroyer<SECKEYPrivateKey, SECKEY_DestroyPrivateKey> > ScopedSECKEYPrivateKey; -typedef scoped_ptr_malloc< - SECAlgorithmID, NSSDestroyer1<SECAlgorithmID, - SECOID_DestroyAlgorithmID, - PR_TRUE> > ScopedSECAlgorithmID; -typedef scoped_ptr_malloc< - SECItem, NSSDestroyer1<SECItem, - SECITEM_FreeItem, - PR_TRUE> > ScopedSECItem; -typedef scoped_ptr_malloc< - PLArenaPool, NSSDestroyer1<PLArenaPool, - PORT_FreeArena, - PR_FALSE> > ScopedPLArenaPool; +typedef scoped_ptr<SECAlgorithmID, + NSSDestroyer1<SECAlgorithmID, SECOID_DestroyAlgorithmID, + PR_TRUE> > + ScopedSECAlgorithmID; +typedef scoped_ptr<SECItem, NSSDestroyer1<SECItem, SECITEM_FreeItem, PR_TRUE> > + ScopedSECItem; +typedef scoped_ptr<PLArenaPool, + NSSDestroyer1<PLArenaPool, PORT_FreeArena, PR_FALSE> > + ScopedPLArenaPool; } // namespace crypto diff --git a/device/hid/hid_connection_mac.h b/device/hid/hid_connection_mac.h index 730eeae..88dfdaa 100644 --- a/device/hid/hid_connection_mac.h +++ b/device/hid/hid_connection_mac.h @@ -60,7 +60,7 @@ class HidConnectionMac : public HidConnection { HidServiceMac* service_; scoped_refptr<base::MessageLoopProxy> message_loop_; base::ScopedCFTypeRef<IOHIDDeviceRef> device_; - scoped_ptr_malloc<uint8_t> inbound_buffer_; + scoped_ptr<uint8_t, base::FreeDeleter> inbound_buffer_; bool disconnected_; typedef std::pair<scoped_refptr<net::IOBuffer>, size_t> PendingReport; diff --git a/device/hid/hid_service_win.cc b/device/hid/hid_service_win.cc index cf9db15..973398f 100644 --- a/device/hid/hid_service_win.cc +++ b/device/hid/hid_service_win.cc @@ -89,9 +89,9 @@ bool HidServiceWin::Enumerate() { &required_size, NULL); - scoped_ptr_malloc<SP_DEVICE_INTERFACE_DETAIL_DATA_A> + scoped_ptr<SP_DEVICE_INTERFACE_DETAIL_DATA_A, base::FreeDeleter> device_interface_detail_data( - reinterpret_cast<SP_DEVICE_INTERFACE_DETAIL_DATA_A*>( + static_cast<SP_DEVICE_INTERFACE_DETAIL_DATA_A*>( malloc(required_size))); device_interface_detail_data->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_A); diff --git a/google_apis/cup/client_update_protocol_nss.cc b/google_apis/cup/client_update_protocol_nss.cc index b369c13..1d3ff24 100644 --- a/google_apis/cup/client_update_protocol_nss.cc +++ b/google_apis/cup/client_update_protocol_nss.cc @@ -12,10 +12,9 @@ #include "crypto/nss_util.h" #include "crypto/scoped_nss_types.h" -typedef scoped_ptr_malloc< - CERTSubjectPublicKeyInfo, - crypto::NSSDestroyer<CERTSubjectPublicKeyInfo, - SECKEY_DestroySubjectPublicKeyInfo> > +typedef scoped_ptr<CERTSubjectPublicKeyInfo, + crypto::NSSDestroyer<CERTSubjectPublicKeyInfo, + SECKEY_DestroySubjectPublicKeyInfo> > ScopedCERTSubjectPublicKeyInfo; ClientUpdateProtocol::~ClientUpdateProtocol() { diff --git a/media/audio/alsa/alsa_output.cc b/media/audio/alsa/alsa_output.cc index f28dfca..308bedc 100644 --- a/media/audio/alsa/alsa_output.cc +++ b/media/audio/alsa/alsa_output.cc @@ -535,13 +535,13 @@ std::string AlsaPcmOutputStream::FindDeviceForChannels(uint32 channels) { for (void** hint_iter = hints; *hint_iter != NULL; hint_iter++) { // Only examine devices that are output capable.. Valid values are // "Input", "Output", and NULL which means both input and output. - scoped_ptr_malloc<char> io( + scoped_ptr<char, base::FreeDeleter> io( wrapper_->DeviceNameGetHint(*hint_iter, kIoHintName)); if (io != NULL && strcmp(io.get(), "Input") == 0) continue; // Attempt to select the closest device for number of channels. - scoped_ptr_malloc<char> name( + scoped_ptr<char, base::FreeDeleter> name( wrapper_->DeviceNameGetHint(*hint_iter, kNameHintName)); if (strncmp(wanted_device, name.get(), strlen(wanted_device)) == 0) { guessed_device = name.get(); diff --git a/media/audio/alsa/audio_manager_alsa.cc b/media/audio/alsa/audio_manager_alsa.cc index 7d6421f..beb60ba 100644 --- a/media/audio/alsa/audio_manager_alsa.cc +++ b/media/audio/alsa/audio_manager_alsa.cc @@ -152,8 +152,8 @@ void AudioManagerAlsa::GetAlsaDevicesInfo( for (void** hint_iter = hints; *hint_iter != NULL; hint_iter++) { // Only examine devices of the right type. Valid values are // "Input", "Output", and NULL which means both input and output. - scoped_ptr_malloc<char> io(wrapper_->DeviceNameGetHint(*hint_iter, - kIoHintName)); + scoped_ptr<char, base::FreeDeleter> io(wrapper_->DeviceNameGetHint( + *hint_iter, kIoHintName)); if (io != NULL && strcmp(unwanted_device_type, io.get()) == 0) continue; @@ -169,13 +169,13 @@ void AudioManagerAlsa::GetAlsaDevicesInfo( } // Get the unique device name for the device. - scoped_ptr_malloc<char> unique_device_name( + scoped_ptr<char, base::FreeDeleter> unique_device_name( wrapper_->DeviceNameGetHint(*hint_iter, kNameHintName)); // Find out if the device is available. if (IsAlsaDeviceAvailable(type, unique_device_name.get())) { // Get the description for the device. - scoped_ptr_malloc<char> desc(wrapper_->DeviceNameGetHint( + scoped_ptr<char, base::FreeDeleter> desc(wrapper_->DeviceNameGetHint( *hint_iter, kDescriptionHintName)); media::AudioDeviceName name; @@ -252,8 +252,8 @@ bool AudioManagerAlsa::HasAnyAlsaAudioDevice( for (void** hint_iter = hints; *hint_iter != NULL; hint_iter++) { // Only examine devices that are |stream| capable. Valid values are // "Input", "Output", and NULL which means both input and output. - scoped_ptr_malloc<char> io(wrapper_->DeviceNameGetHint(*hint_iter, - kIoHintName)); + scoped_ptr<char, base::FreeDeleter> io(wrapper_->DeviceNameGetHint( + *hint_iter, kIoHintName)); const char* unwanted_type = UnwantedDeviceTypeWhenEnumerating(stream); if (io != NULL && strcmp(unwanted_type, io.get()) == 0) continue; // Wrong type, skip the device. diff --git a/media/audio/mac/audio_manager_mac.cc b/media/audio/mac/audio_manager_mac.cc index 4b4e4fa..79ebe60 100644 --- a/media/audio/mac/audio_manager_mac.cc +++ b/media/audio/mac/audio_manager_mac.cc @@ -76,8 +76,8 @@ static void GetAudioDeviceInfo(bool is_input, // Get the array of device ids for all the devices, which includes both // input devices and output devices. - scoped_ptr_malloc<AudioDeviceID> - devices(reinterpret_cast<AudioDeviceID*>(malloc(size))); + scoped_ptr<AudioDeviceID, base::FreeDeleter> + devices(static_cast<AudioDeviceID*>(malloc(size))); AudioDeviceID* device_ids = devices.get(); result = AudioObjectGetPropertyData(kAudioObjectSystemObject, &property_address, @@ -488,8 +488,8 @@ std::string AudioManagerMac::GetAssociatedOutputDeviceID( return std::string(); int device_count = size / sizeof(AudioDeviceID); - scoped_ptr_malloc<AudioDeviceID> - devices(reinterpret_cast<AudioDeviceID*>(malloc(size))); + scoped_ptr<AudioDeviceID, base::FreeDeleter> + devices(static_cast<AudioDeviceID*>(malloc(size))); result = AudioObjectGetPropertyData( device, &pa, 0, NULL, &size, devices.get()); if (result) diff --git a/net/base/io_buffer.h b/net/base/io_buffer.h index 77712e7..0ce52e8 100644 --- a/net/base/io_buffer.h +++ b/net/base/io_buffer.h @@ -203,7 +203,7 @@ class NET_EXPORT GrowableIOBuffer : public IOBuffer { private: virtual ~GrowableIOBuffer(); - scoped_ptr_malloc<char> real_data_; + scoped_ptr<char, base::FreeDeleter> real_data_; int capacity_; int offset_; }; diff --git a/net/cert/cert_verify_proc_nss.cc b/net/cert/cert_verify_proc_nss.cc index 748d1d3..9d3652b 100644 --- a/net/cert/cert_verify_proc_nss.cc +++ b/net/cert/cert_verify_proc_nss.cc @@ -37,13 +37,13 @@ namespace net { namespace { -typedef scoped_ptr_malloc< +typedef scoped_ptr< CERTCertificatePolicies, crypto::NSSDestroyer<CERTCertificatePolicies, CERT_DestroyCertificatePoliciesExtension> > ScopedCERTCertificatePolicies; -typedef scoped_ptr_malloc< +typedef scoped_ptr< CERTCertList, crypto::NSSDestroyer<CERTCertList, CERT_DestroyCertList> > ScopedCERTCertList; diff --git a/net/cert/cert_verify_proc_win.cc b/net/cert/cert_verify_proc_win.cc index 0639b3d..b6ab2b6 100644 --- a/net/cert/cert_verify_proc_win.cc +++ b/net/cert/cert_verify_proc_win.cc @@ -61,12 +61,11 @@ struct FreeCertContextFunctor { typedef crypto::ScopedCAPIHandle<HCERTCHAINENGINE, FreeChainEngineFunctor> ScopedHCERTCHAINENGINE; -typedef scoped_ptr_malloc<const CERT_CHAIN_CONTEXT, - FreeCertChainContextFunctor> +typedef scoped_ptr<const CERT_CHAIN_CONTEXT, FreeCertChainContextFunctor> ScopedPCCERT_CHAIN_CONTEXT; -typedef scoped_ptr_malloc<const CERT_CONTEXT, - FreeCertContextFunctor> ScopedPCCERT_CONTEXT; +typedef scoped_ptr<const CERT_CONTEXT, FreeCertContextFunctor> + ScopedPCCERT_CONTEXT; //----------------------------------------------------------------------------- @@ -200,7 +199,7 @@ bool CertSubjectCommonNameHasNull(PCCERT_CONTEXT cert) { &name_info, &name_info_size); if (rv) { - scoped_ptr_malloc<CERT_NAME_INFO> scoped_name_info(name_info); + scoped_ptr<CERT_NAME_INFO, base::FreeDeleter> scoped_name_info(name_info); // The Subject field may have multiple common names. According to the // "PKI Layer Cake" paper, CryptoAPI uses every common name in the @@ -349,8 +348,9 @@ void GetCertChainInfo(PCCERT_CHAIN_CONTEXT chain_context, // Decodes the cert's certificatePolicies extension into a CERT_POLICIES_INFO // structure and stores it in *output. -void GetCertPoliciesInfo(PCCERT_CONTEXT cert, - scoped_ptr_malloc<CERT_POLICIES_INFO>* output) { +void GetCertPoliciesInfo( + PCCERT_CONTEXT cert, + scoped_ptr<CERT_POLICIES_INFO, base::FreeDeleter>* output) { PCERT_EXTENSION extension = CertFindExtension(szOID_CERT_POLICIES, cert->pCertInfo->cExtension, cert->pCertInfo->rgExtension); @@ -570,7 +570,7 @@ int CertVerifyProcWin::VerifyInternal( const_cast<LPSTR*>(usage); // Get the certificatePolicies extension of the certificate. - scoped_ptr_malloc<CERT_POLICIES_INFO> policies_info; + scoped_ptr<CERT_POLICIES_INFO, base::FreeDeleter> policies_info; LPSTR ev_policy_oid = NULL; if (flags & CertVerifier::VERIFY_EV_CERT) { GetCertPoliciesInfo(cert_handle, &policies_info); diff --git a/net/cert/jwk_serializer_nss.cc b/net/cert/jwk_serializer_nss.cc index 3da0a81..1db65f7 100644 --- a/net/cert/jwk_serializer_nss.cc +++ b/net/cert/jwk_serializer_nss.cc @@ -69,7 +69,7 @@ bool ConvertEcPublicKeyInfoToJwk( return false; } -typedef scoped_ptr_malloc< +typedef scoped_ptr< CERTSubjectPublicKeyInfo, crypto::NSSDestroyer<CERTSubjectPublicKeyInfo, SECKEY_DestroySubjectPublicKeyInfo> > diff --git a/net/cert/scoped_nss_types.h b/net/cert/scoped_nss_types.h index 3e6d57d..0eb8d84 100644 --- a/net/cert/scoped_nss_types.h +++ b/net/cert/scoped_nss_types.h @@ -1,7 +1,7 @@ // Copyright 2013 The Chromium Authors. All rights reserved. -// // Use of this source code is governed by a BSD-style license that can be -// // found in the LICENSE file. -// +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + #ifndef NET_CERT_SCOPED_NSS_TYPES_H_ #define NET_CERT_SCOPED_NSS_TYPES_H_ @@ -12,14 +12,12 @@ namespace net { struct FreeCERTCertificate { - public: void operator()(CERTCertificate* x) const { CERT_DestroyCertificate(x); } }; -typedef scoped_ptr_malloc<CERTCertificate, FreeCERTCertificate> - ScopedCERTCertificate; +typedef scoped_ptr<CERTCertificate, FreeCERTCertificate> ScopedCERTCertificate; } // namespace net diff --git a/net/cert/x509_cert_types_win.cc b/net/cert/x509_cert_types_win.cc index 8d9a25a..570f5fc 100644 --- a/net/cert/x509_cert_types_win.cc +++ b/net/cert/x509_cert_types_win.cc @@ -105,7 +105,7 @@ bool CertPrincipal::ParseDistinguishedName(const void* ber_name_data, &name_info, &name_info_size); if (!rv) return false; - scoped_ptr_malloc<CERT_NAME_INFO> scoped_name_info(name_info); + scoped_ptr<CERT_NAME_INFO, base::FreeDeleter> scoped_name_info(name_info); std::vector<std::string> common_names, locality_names, state_names, country_names; diff --git a/net/cert/x509_certificate_win.cc b/net/cert/x509_certificate_win.cc index f0c9e50..c3f0a27 100644 --- a/net/cert/x509_certificate_win.cc +++ b/net/cert/x509_certificate_win.cc @@ -45,8 +45,9 @@ void ExplodedTimeToSystemTime(const base::Time::Exploded& exploded, // Decodes the cert's subjectAltName extension into a CERT_ALT_NAME_INFO // structure and stores it in *output. -void GetCertSubjectAltName(PCCERT_CONTEXT cert, - scoped_ptr_malloc<CERT_ALT_NAME_INFO>* output) { +void GetCertSubjectAltName( + PCCERT_CONTEXT cert, + scoped_ptr<CERT_ALT_NAME_INFO, base::FreeDeleter>* output) { PCERT_EXTENSION extension = CertFindExtension(szOID_SUBJECT_ALT_NAME2, cert->pCertInfo->cExtension, cert->pCertInfo->rgExtension); @@ -175,7 +176,7 @@ void X509Certificate::GetSubjectAltName( if (!cert_handle_) return; - scoped_ptr_malloc<CERT_ALT_NAME_INFO> alt_name_info; + scoped_ptr<CERT_ALT_NAME_INFO, base::FreeDeleter> alt_name_info; GetCertSubjectAltName(cert_handle_, &alt_name_info); CERT_ALT_NAME_INFO* alt_name = alt_name_info.get(); if (alt_name) { diff --git a/net/cert/x509_util_nss.cc b/net/cert/x509_util_nss.cc index 67ad467..beed9a1 100644 --- a/net/cert/x509_util_nss.cc +++ b/net/cert/x509_util_nss.cc @@ -214,7 +214,7 @@ SECStatus PR_CALLBACK CollectCertsCallback(void* arg, return SECSuccess; } -typedef scoped_ptr_malloc< +typedef scoped_ptr< CERTName, crypto::NSSDestroyer<CERTName, CERT_DestroyName> > ScopedCERTName; diff --git a/net/dns/address_sorter_win.cc b/net/dns/address_sorter_win.cc index 3e1afa7..813bd93 100644 --- a/net/dns/address_sorter_win.cc +++ b/net/dns/address_sorter_win.cc @@ -124,8 +124,8 @@ class AddressSorterWin : public AddressSorter { const CallbackType callback_; const size_t buffer_size_; - scoped_ptr_malloc<SOCKET_ADDRESS_LIST> input_buffer_; - scoped_ptr_malloc<SOCKET_ADDRESS_LIST> output_buffer_; + scoped_ptr<SOCKET_ADDRESS_LIST, base::FreeDeleter> input_buffer_; + scoped_ptr<SOCKET_ADDRESS_LIST, base::FreeDeleter> output_buffer_; bool success_; DISALLOW_COPY_AND_ASSIGN(Job); diff --git a/net/dns/dns_config_service_win.cc b/net/dns/dns_config_service_win.cc index 64b912d..dcc9181 100644 --- a/net/dns/dns_config_service_win.cc +++ b/net/dns/dns_config_service_win.cc @@ -113,16 +113,16 @@ class RegistryReader : public base::NonThreadSafe { }; // Wrapper for GetAdaptersAddresses. Returns NULL if failed. -scoped_ptr_malloc<IP_ADAPTER_ADDRESSES> ReadIpHelper(ULONG flags) { +scoped_ptr<IP_ADAPTER_ADDRESSES, base::FreeDeleter> ReadIpHelper(ULONG flags) { base::ThreadRestrictions::AssertIOAllowed(); - scoped_ptr_malloc<IP_ADAPTER_ADDRESSES> out; + scoped_ptr<IP_ADAPTER_ADDRESSES, base::FreeDeleter> out; ULONG len = 15000; // As recommended by MSDN for GetAdaptersAddresses. UINT rv = ERROR_BUFFER_OVERFLOW; // Try up to three times. for (unsigned tries = 0; (tries < 3) && (rv == ERROR_BUFFER_OVERFLOW); tries++) { - out.reset(reinterpret_cast<PIP_ADAPTER_ADDRESSES>(malloc(len))); + out.reset(static_cast<PIP_ADAPTER_ADDRESSES>(malloc(len))); rv = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, out.get(), &len); } if (rv != NO_ERROR) @@ -250,7 +250,7 @@ HostsParseWinResult AddLocalhostEntries(DnsHosts* hosts) { if (have_ipv4 && have_ipv6) return HOSTS_PARSE_WIN_OK; - scoped_ptr_malloc<IP_ADAPTER_ADDRESSES> addresses = + scoped_ptr<IP_ADAPTER_ADDRESSES, base::FreeDeleter> addresses = ReadIpHelper(GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_DNS_SERVER | GAA_FLAG_SKIP_MULTICAST | diff --git a/net/dns/dns_config_service_win.h b/net/dns/dns_config_service_win.h index 9503dc8..d26aed5 100644 --- a/net/dns/dns_config_service_win.h +++ b/net/dns/dns_config_service_win.h @@ -65,7 +65,7 @@ struct NET_EXPORT_PRIVATE DnsSystemSettings { // Filled in by GetAdapterAddresses. Note that the alternative // GetNetworkParams does not include IPv6 addresses. - scoped_ptr_malloc<IP_ADAPTER_ADDRESSES> addresses; + scoped_ptr<IP_ADAPTER_ADDRESSES, base::FreeDeleter> addresses; // SOFTWARE\Policies\Microsoft\Windows NT\DNSClient\SearchList RegString policy_search_list; diff --git a/net/dns/dns_config_service_win_unittest.cc b/net/dns/dns_config_service_win_unittest.cc index 3f3e4ed..7ac01d1 100644 --- a/net/dns/dns_config_service_win_unittest.cc +++ b/net/dns/dns_config_service_win_unittest.cc @@ -58,7 +58,7 @@ struct AdapterInfo { int ports[4]; }; -scoped_ptr_malloc<IP_ADAPTER_ADDRESSES> CreateAdapterAddresses( +scoped_ptr<IP_ADAPTER_ADDRESSES, base::FreeDeleter> CreateAdapterAddresses( const AdapterInfo* infos) { size_t num_adapters = 0; size_t num_addresses = 0; @@ -72,8 +72,8 @@ scoped_ptr_malloc<IP_ADAPTER_ADDRESSES> CreateAdapterAddresses( size_t heap_size = num_adapters * sizeof(IP_ADAPTER_ADDRESSES) + num_addresses * (sizeof(IP_ADAPTER_DNS_SERVER_ADDRESS) + sizeof(struct sockaddr_storage)); - scoped_ptr_malloc<IP_ADAPTER_ADDRESSES> heap( - reinterpret_cast<IP_ADAPTER_ADDRESSES*>(malloc(heap_size))); + scoped_ptr<IP_ADAPTER_ADDRESSES, base::FreeDeleter> heap( + static_cast<IP_ADAPTER_ADDRESSES*>(malloc(heap_size))); CHECK(heap.get()); memset(heap.get(), 0, heap_size); diff --git a/net/proxy/dhcp_proxy_script_adapter_fetcher_win.cc b/net/proxy/dhcp_proxy_script_adapter_fetcher_win.cc index 569e812..738f0c1 100644 --- a/net/proxy/dhcp_proxy_script_adapter_fetcher_win.cc +++ b/net/proxy/dhcp_proxy_script_adapter_fetcher_win.cc @@ -233,11 +233,11 @@ std::string DhcpProxyScriptAdapterFetcher::GetPacURLFromDhcp( // The maximum message size is typically 4096 bytes on Windows per // http://support.microsoft.com/kb/321592 DWORD result_buffer_size = 4096; - scoped_ptr_malloc<BYTE> result_buffer; + scoped_ptr<BYTE, base::FreeDeleter> result_buffer; int retry_count = 0; DWORD res = NO_ERROR; do { - result_buffer.reset(reinterpret_cast<BYTE*>(malloc(result_buffer_size))); + result_buffer.reset(static_cast<BYTE*>(malloc(result_buffer_size))); // Note that while the DHCPCAPI_REQUEST_SYNCHRONOUS flag seems to indicate // there might be an asynchronous mode, there seems to be (at least in @@ -261,7 +261,7 @@ std::string DhcpProxyScriptAdapterFetcher::GetPacURLFromDhcp( } while (res == ERROR_MORE_DATA && retry_count <= 3); if (res != NO_ERROR) { - LOG(INFO) << "Error fetching PAC URL from DHCP: " << res; + LOG(WARNING) << "Error fetching PAC URL from DHCP: " << res; UMA_HISTOGRAM_COUNTS("Net.DhcpWpadUnhandledDhcpError", 1); } else if (wpad_params.nBytesData) { return SanitizeDhcpApiString( diff --git a/net/proxy/dhcp_proxy_script_fetcher_win.cc b/net/proxy/dhcp_proxy_script_fetcher_win.cc index 037268f..54e2bdf 100644 --- a/net/proxy/dhcp_proxy_script_fetcher_win.cc +++ b/net/proxy/dhcp_proxy_script_fetcher_win.cc @@ -320,14 +320,13 @@ bool DhcpProxyScriptFetcherWin::GetCandidateAdapterNames( // The GetAdaptersAddresses MSDN page recommends using a size of 15000 to // avoid reallocation. ULONG adapters_size = 15000; - scoped_ptr_malloc<IP_ADAPTER_ADDRESSES> adapters; + scoped_ptr<IP_ADAPTER_ADDRESSES, base::FreeDeleter> adapters; ULONG error = ERROR_SUCCESS; int num_tries = 0; base::ElapsedTimer time_api_access; do { - adapters.reset( - reinterpret_cast<IP_ADAPTER_ADDRESSES*>(malloc(adapters_size))); + adapters.reset(static_cast<IP_ADAPTER_ADDRESSES*>(malloc(adapters_size))); // Return only unicast addresses, and skip information we do not need. error = GetAdaptersAddresses(AF_UNSPEC, GAA_FLAG_SKIP_ANYCAST | diff --git a/net/socket_stream/socket_stream.h b/net/socket_stream/socket_stream.h index a91d5ca..b86f20a 100644 --- a/net/socket_stream/socket_stream.h +++ b/net/socket_stream/socket_stream.h @@ -223,7 +223,7 @@ class NET_EXPORT SocketStream private: virtual ~ResponseHeaders(); - scoped_ptr_malloc<char> headers_; + scoped_ptr<char, base::FreeDeleter> headers_; }; enum State { diff --git a/sandbox/win/src/Wow64.cc b/sandbox/win/src/Wow64.cc index b11026b..59df1d6 100644 --- a/sandbox/win/src/Wow64.cc +++ b/sandbox/win/src/Wow64.cc @@ -153,7 +153,8 @@ bool Wow64::RunWowHelper(void* buffer) { L"wow_helper.exe\" " << child_->ProcessId() << " " << bit_cast<ULONG>(buffer); - scoped_ptr_malloc<wchar_t> writable_command(_wcsdup(command.str().c_str())); + scoped_ptr<wchar_t, base::FreeDeleter> + writable_command(_wcsdup(command.str().c_str())); STARTUPINFO startup_info = {0}; startup_info.cb = sizeof(startup_info); diff --git a/sandbox/win/src/acl.cc b/sandbox/win/src/acl.cc index 0f2936ab..ef804df 100644 --- a/sandbox/win/src/acl.cc +++ b/sandbox/win/src/acl.cc @@ -11,8 +11,9 @@ namespace sandbox { -bool GetDefaultDacl(HANDLE token, - scoped_ptr_malloc<TOKEN_DEFAULT_DACL>* default_dacl) { +bool GetDefaultDacl( + HANDLE token, + scoped_ptr<TOKEN_DEFAULT_DACL, base::FreeDeleter>* default_dacl) { if (token == NULL) return false; @@ -59,7 +60,7 @@ bool AddSidToDefaultDacl(HANDLE token, const Sid& sid, ACCESS_MASK access) { if (token == NULL) return false; - scoped_ptr_malloc<TOKEN_DEFAULT_DACL> default_dacl; + scoped_ptr<TOKEN_DEFAULT_DACL, base::FreeDeleter> default_dacl; if (!GetDefaultDacl(token, &default_dacl)) return false; @@ -81,7 +82,7 @@ bool AddUserSidToDefaultDacl(HANDLE token, ACCESS_MASK access) { DWORD size = sizeof(TOKEN_USER) + SECURITY_MAX_SID_SIZE; TOKEN_USER* token_user = reinterpret_cast<TOKEN_USER*>(malloc(size)); - scoped_ptr_malloc<TOKEN_USER> token_user_ptr(token_user); + scoped_ptr<TOKEN_USER, base::FreeDeleter> token_user_ptr(token_user); if (!::GetTokenInformation(token, TokenUser, token_user, size, &size)) return false; diff --git a/sandbox/win/src/acl.h b/sandbox/win/src/acl.h index 531259f..b5021e7 100644 --- a/sandbox/win/src/acl.h +++ b/sandbox/win/src/acl.h @@ -14,8 +14,9 @@ namespace sandbox { // Returns the default dacl from the token passed in. -bool GetDefaultDacl(HANDLE token, - scoped_ptr_malloc<TOKEN_DEFAULT_DACL>* default_dacl); +bool GetDefaultDacl( + HANDLE token, + scoped_ptr<TOKEN_DEFAULT_DACL, base::FreeDeleter>* default_dacl); // Appends an ACE represented by |sid|, |access_mode|, and |access| to // |old_dacl|. If the function succeeds, new_dacl contains the new dacl and diff --git a/sandbox/win/src/process_thread_policy.cc b/sandbox/win/src/process_thread_policy.cc index 85a2f97..f2029ba 100644 --- a/sandbox/win/src/process_thread_policy.cc +++ b/sandbox/win/src/process_thread_policy.cc @@ -227,7 +227,8 @@ DWORD ProcessPolicy::CreateProcessWAction(EvalResult eval_result, STARTUPINFO startup_info = {0}; startup_info.cb = sizeof(startup_info); - scoped_ptr_malloc<wchar_t> cmd_line(_wcsdup(command_line.c_str())); + scoped_ptr<wchar_t, base::FreeDeleter> + cmd_line(_wcsdup(command_line.c_str())); BOOL should_give_full_access = (GIVE_ALLACCESS == eval_result); if (!CreateProcessExWHelper(client_info.process, should_give_full_access, diff --git a/sandbox/win/src/target_process.cc b/sandbox/win/src/target_process.cc index a2d630c..5f73adc 100644 --- a/sandbox/win/src/target_process.cc +++ b/sandbox/win/src/target_process.cc @@ -116,7 +116,7 @@ DWORD TargetProcess::Create(const wchar_t* exe_path, exe_name_.reset(_wcsdup(exe_path)); // the command line needs to be writable by CreateProcess(). - scoped_ptr_malloc<wchar_t> cmd_line(_wcsdup(command_line)); + scoped_ptr<wchar_t, base::FreeDeleter> cmd_line(_wcsdup(command_line)); // Start the target process suspended. DWORD flags = diff --git a/sandbox/win/src/target_process.h b/sandbox/win/src/target_process.h index 0b72d98..9a8dded 100644 --- a/sandbox/win/src/target_process.h +++ b/sandbox/win/src/target_process.h @@ -113,7 +113,7 @@ class TargetProcess { // Base address of the main executable void* base_address_; // Full name of the target executable. - scoped_ptr_malloc<wchar_t> exe_name_; + scoped_ptr<wchar_t, base::FreeDeleter> exe_name_; // Function used for testing. friend TargetProcess* MakeTestTargetProcess(HANDLE process, |