diff options
| author | 2017-03-01 02:02:40 +0000 | |
|---|---|---|
| committer | 2017-03-01 02:02:40 +0000 | |
| commit | e556f11be4f2384d063907327af89371aeea2888 (patch) | |
| tree | b1adb49d4f48b767593a0ee5b966fa9ee816e41b | |
| parent | 1b4cdf909f7c9f3ad9b12d666ca5a4c1dde43308 (diff) | |
| parent | 0d0ccb0c19583bd445385ac5506459fe59679f4f (diff) | |
Merge "Fix memory-leak warnings from the static analyzer" am: 2006bfc9ad am: 43fd84a03c
am: 0d0ccb0c19
Change-Id: I0abbba291721af2b66735dcbd33bbc406767536c
| -rw-r--r-- | core/jni/android_view_InputChannel.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/core/jni/android_view_InputChannel.cpp b/core/jni/android_view_InputChannel.cpp index c7998a169225..1c6ead0f1086 100644 --- a/core/jni/android_view_InputChannel.cpp +++ b/core/jni/android_view_InputChannel.cpp @@ -111,11 +111,12 @@ void android_view_InputChannel_setDisposeCallback(JNIEnv* env, jobject inputChan } static jobject android_view_InputChannel_createInputChannel(JNIEnv* env, - NativeInputChannel* nativeInputChannel) { + std::unique_ptr<NativeInputChannel> nativeInputChannel) { jobject inputChannelObj = env->NewObject(gInputChannelClassInfo.clazz, gInputChannelClassInfo.ctor); if (inputChannelObj) { - android_view_InputChannel_setNativeInputChannel(env, inputChannelObj, nativeInputChannel); + android_view_InputChannel_setNativeInputChannel(env, inputChannelObj, + nativeInputChannel.release()); } return inputChannelObj; } @@ -143,13 +144,13 @@ static jobjectArray android_view_InputChannel_nativeOpenInputChannelPair(JNIEnv* } jobject serverChannelObj = android_view_InputChannel_createInputChannel(env, - new NativeInputChannel(serverChannel)); + std::make_unique<NativeInputChannel>(serverChannel)); if (env->ExceptionCheck()) { return NULL; } jobject clientChannelObj = android_view_InputChannel_createInputChannel(env, - new NativeInputChannel(clientChannel)); + std::make_unique<NativeInputChannel>(clientChannel)); if (env->ExceptionCheck()) { return NULL; } |