Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5ddfa247 authored by Victoria Lease's avatar Victoria Lease Committed by Android Git Automerger
Browse files

am fc56015b: Merge "Possible leak in android_emoji_EmojiFactory_newInstance"

* commit 'fc56015b':
  Possible leak in android_emoji_EmojiFactory_newInstance
parents b7f4bf36 fc56015b
Loading
Loading
Loading
Loading
+5 −9
Original line number Diff line number Diff line
@@ -3,8 +3,7 @@

#define LOG_TAG "EmojiFactory_jni"
#include <utils/Log.h>
#include <utils/String8.h>
#include <utils/String16.h>
#include <ScopedUtfChars.h>

#include "EmojiFactory.h"
#include <nativehelper/JNIHelp.h>
@@ -125,16 +124,13 @@ static jobject android_emoji_EmojiFactory_newInstance(
    return NULL;
  }

  const jchar* jchars = env->GetStringChars(name, NULL);
  jsize len = env->GetStringLength(name);
  String8 str(String16(jchars, len));
  ScopedUtfChars nameUtf(env, name);

  EmojiFactory *factory = gCaller->TryCallGetImplementation(str.string());
  EmojiFactory *factory = gCaller->TryCallGetImplementation(nameUtf.c_str());
  // EmojiFactory *factory = EmojiFactory::GetImplementation(str.string());
  if (NULL == factory) {
    return NULL;
  }
  env->ReleaseStringChars(name, jchars);

  return create_java_EmojiFactory(env, factory, name);
}
@@ -151,8 +147,8 @@ static jobject android_emoji_EmojiFactory_newAvailableInstance(
  if (NULL == factory) {
    return NULL;
  }
  String16 name_16(String8(factory->Name()));
  jstring jname = env->NewString(name_16.string(), name_16.size());

  jstring jname = env->NewStringUTF(factory->Name());
  if (NULL == jname) {
    return NULL;
  }