Merge "Fix a mismatched malloc/delete" am: 619ac6c26b am: 05033f69eb am: 8616719671
am: 6a7d20c257
Change-Id: I97995297559feefed6a7cff79588d17c58d1efa5
diff --git a/keymaster_qcom.cpp b/keymaster_qcom.cpp
index b7ec9ce..0ad3330 100644
--- a/keymaster_qcom.cpp
+++ b/keymaster_qcom.cpp
@@ -172,13 +172,13 @@
return -1;
}
- UniquePtr<uint8_t> key(static_cast<uint8_t*>(malloc(len)));
+ UniquePtr<unsigned char[]> key(new unsigned char[len]);
if (key.get() == NULL) {
ALOGE("Could not allocate memory for public key data");
return -1;
}
- unsigned char* tmp = reinterpret_cast<unsigned char*>(key.get());
+ unsigned char* tmp = key.get();
if (i2d_PUBKEY(pkey.get(), &tmp) != len) {
ALOGE("Len 2 returned is < 0 len = %d", len);
return -1;