Index: crypto/secure_hash.cc |
diff --git a/crypto/secure_hash.cc b/crypto/secure_hash.cc |
index 2a5a1f02089e6f1ddd24523ab6f39fd31bea744a..76d42d33f72a00aa6d84dea35d5a6c4a41ccbeb2 100644 |
--- a/crypto/secure_hash.cc |
+++ b/crypto/secure_hash.cc |
@@ -9,6 +9,7 @@ |
#include <stddef.h> |
#include "base/logging.h" |
+#include "base/memory/ptr_util.h" |
#include "base/pickle.h" |
#include "crypto/openssl_util.h" |
@@ -40,8 +41,8 @@ class SecureHashSHA256 : public SecureHash { |
SHA256_Final(result.safe_buffer(), &ctx_); |
} |
- SecureHash* Clone() const override { |
- return new SecureHashSHA256(*this); |
+ std::unique_ptr<SecureHash> Clone() const override { |
+ return base::MakeUnique<SecureHashSHA256>(*this); |
} |
size_t GetHashLength() const override { return SHA256_DIGEST_LENGTH; } |
@@ -52,13 +53,13 @@ class SecureHashSHA256 : public SecureHash { |
} // namespace |
-SecureHash* SecureHash::Create(Algorithm algorithm) { |
+std::unique_ptr<SecureHash> SecureHash::Create(Algorithm algorithm) { |
switch (algorithm) { |
case SHA256: |
- return new SecureHashSHA256(); |
+ return base::MakeUnique<SecureHashSHA256>(); |
default: |
NOTIMPLEMENTED(); |
- return NULL; |
+ return nullptr; |
} |
} |