Index: net/third_party/mozilla_security_manager/nsPKCS12Blob.cpp |
diff --git a/net/third_party/mozilla_security_manager/nsPKCS12Blob.cpp b/net/third_party/mozilla_security_manager/nsPKCS12Blob.cpp |
index ab20b22d1f6f9a13583b68cfd3d5de7a5c7f560a..eac7ace1960b0f22ed281c2c3bcd1c3b67db98f2 100644 |
--- a/net/third_party/mozilla_security_manager/nsPKCS12Blob.cpp |
+++ b/net/third_party/mozilla_security_manager/nsPKCS12Blob.cpp |
@@ -42,6 +42,7 @@ |
#include <p12plcy.h> |
#include <secerr.h> |
+#include "base/crypto/scoped_nss_types.h" |
#include "base/logging.h" |
#include "base/nss_util_internal.h" |
#include "base/string_util.h" |
@@ -260,14 +261,14 @@ void EnsurePKCS12Init() { |
int nsPKCS12Blob_Import(const char* pkcs12_data, |
size_t pkcs12_len, |
const string16& password) { |
- PK11SlotInfo *slot = base::GetDefaultNSSKeySlot(); |
- if (!slot) { |
+ base::ScopedPK11Slot slot(base::GetDefaultNSSKeySlot()); |
+ if (!slot.get()) { |
LOG(ERROR) << "Couldn't get Internal key slot!"; |
return net::ERR_PKCS12_IMPORT_FAILED; |
} |
int rv = nsPKCS12Blob_ImportHelper(pkcs12_data, pkcs12_len, password, false, |
- slot); |
+ slot.get()); |
// When the user entered a zero length password: |
// An empty password should be represented as an empty |
@@ -278,10 +279,8 @@ int nsPKCS12Blob_Import(const char* pkcs12_data, |
// without giving a user prompt when trying the different empty password flavors. |
if (rv == net::ERR_PKCS12_IMPORT_BAD_PASSWORD && password.size() == 0) { |
rv = nsPKCS12Blob_ImportHelper(pkcs12_data, pkcs12_len, password, true, |
- slot); |
+ slot.get()); |
} |
- |
- PK11_FreeSlot(slot); |
return rv; |
} |