summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Moreland <smoreland@google.com>2019-04-18 16:32:42 -0700
committerandroid-build-team Robot <android-build-team-robot@google.com>2019-05-14 04:57:12 +0000
commit3256e59a87466b1a1d20a6cfe22617e23fa25299 (patch)
tree1a804f7854fc92a3dca3d6c6e92795e2e81c785f
parent11d913944f53dd189c027068aaea5fc87316e962 (diff)
downloadbase-3256e59a87466b1a1d20a6cfe22617e23fa25299.tar.gz
HwBlob: s/malloc/calloc/
Since this blob is passed between processes. We could potentially only memset portions of the blob as it is written to. However, the JHwBlob API itself doesn't have to have writes in order (even though known usages of it do write in order). Because of this, keeping track of which bytes to pad would be too expensive. Bug: 131356202 Test: boot, hidl_test_java Change-Id: I48f4d7cb20c4bfe747dd323ae3744d323ad097c9 Merged-In: I48f4d7cb20c4bfe747dd323ae3744d323ad097c9 (cherry picked from commit d8157bc094569bee74976df2585d632f1793e226)
-rw-r--r--core/jni/android_os_HwBlob.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/jni/android_os_HwBlob.cpp b/core/jni/android_os_HwBlob.cpp
index bb916d2431c5..09589cdb0801 100644
--- a/core/jni/android_os_HwBlob.cpp
+++ b/core/jni/android_os_HwBlob.cpp
@@ -85,7 +85,7 @@ JHwBlob::JHwBlob(JNIEnv *env, jobject thiz, size_t size)
mOwnsBuffer(true),
mHandle(0) {
if (size > 0) {
- mBuffer = malloc(size);
+ mBuffer = calloc(size, 1);
}
}