diff options
author | Iliyan Malchev <malchev@google.com> | 2012-02-17 14:28:38 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-02-17 14:28:38 -0800 |
commit | d7a3aa452c2edccfbf18015567f9de6cba0f6eeb (patch) | |
tree | a62a0d4803aad4b5da49151bb9f80bb8fcba1984 | |
parent | e97df97b6cb5e4bff8f9da9ecff7cddb7d04ff41 (diff) | |
parent | 8d25cb8a640cfe22809bc6afa493a48adc49c4ad (diff) | |
download | frameworks_base-d7a3aa452c2edccfbf18015567f9de6cba0f6eeb.zip frameworks_base-d7a3aa452c2edccfbf18015567f9de6cba0f6eeb.tar.gz frameworks_base-d7a3aa452c2edccfbf18015567f9de6cba0f6eeb.tar.bz2 |
Merge "bluetooth: replace malloc() + memset() to zero with calloc()"
-rw-r--r-- | core/jni/android_server_BluetoothEventLoop.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/core/jni/android_server_BluetoothEventLoop.cpp b/core/jni/android_server_BluetoothEventLoop.cpp index 9292fc0..8a69ba4 100644 --- a/core/jni/android_server_BluetoothEventLoop.cpp +++ b/core/jni/android_server_BluetoothEventLoop.cpp @@ -164,7 +164,6 @@ static void initializeNativeDataNative(JNIEnv* env, jobject object) { ALOGE("%s: out of memory!", __FUNCTION__); return; } - memset(nat, 0, sizeof(native_data_t)); pthread_mutex_init(&(nat->thread_mutex), NULL); @@ -722,24 +721,20 @@ static jboolean startEventLoopNative(JNIEnv *env, jobject object) { return JNI_FALSE; } - nat->pollData = (struct pollfd *)malloc(sizeof(struct pollfd) * - DEFAULT_INITIAL_POLLFD_COUNT); + nat->pollData = (struct pollfd *)calloc( + DEFAULT_INITIAL_POLLFD_COUNT, sizeof(struct pollfd)); if (!nat->pollData) { ALOGE("out of memory error starting EventLoop!"); goto done; } - nat->watchData = (DBusWatch **)malloc(sizeof(DBusWatch *) * - DEFAULT_INITIAL_POLLFD_COUNT); + nat->watchData = (DBusWatch **)calloc( + DEFAULT_INITIAL_POLLFD_COUNT, sizeof(DBusWatch *)); if (!nat->watchData) { ALOGE("out of memory error starting EventLoop!"); goto done; } - memset(nat->pollData, 0, sizeof(struct pollfd) * - DEFAULT_INITIAL_POLLFD_COUNT); - memset(nat->watchData, 0, sizeof(DBusWatch *) * - DEFAULT_INITIAL_POLLFD_COUNT); nat->pollDataSize = DEFAULT_INITIAL_POLLFD_COUNT; nat->pollMemberCount = 1; |