Fix memory leak related to GetStringUTFChars.

GetStringUTFChars needs to be paired with ReleaseStringUTFChars.

PiperOrigin-RevId: 338337619
Change-Id: I9c0d7c0c9d810a880f4f462fbb2563acd59d7388
This commit is contained in:
A. Unique TensorFlower 2020-10-21 14:16:10 -07:00 committed by TensorFlower Gardener
parent a4daf15271
commit adce39ad55

View File

@ -45,6 +45,7 @@ Java_org_tensorflow_lite_HexagonDelegate_setAdspLibraryPath(
std::stringstream path;
path << lib_dir_path
<< ";/system/lib/rfsa/adsp;/system/vendor/lib/rfsa/adsp;/dsp";
env->ReleaseStringUTFChars(native_lib_path, lib_dir_path);
return setenv("ADSP_LIBRARY_PATH", path.str().c_str(), 1 /*override*/) == 0
? JNI_TRUE
: JNI_FALSE;