diff --git a/librarylog4a/src/main/cpp/log4a-lib.cpp b/librarylog4a/src/main/cpp/log4a-lib.cpp index c0239e8..ce6be6d 100644 --- a/librarylog4a/src/main/cpp/log4a-lib.cpp +++ b/librarylog4a/src/main/cpp/log4a-lib.cpp @@ -33,14 +33,14 @@ static jlong initNative(JNIEnv *env, jclass type, jstring buffer_path_, buffer_ptr = new char[buffer_size]; map_buffer = false; } - env->ReleaseStringUTFChars(buffer_path_, buffer_path); - env->ReleaseStringUTFChars(log_path_, log_path); - LogBuffer* logBuffer = new LogBuffer(buffer_ptr, buffer_size); logBuffer->setAsyncFileFlush(fileFlush); //将buffer内的数据清0, 并写入日志文件路径 logBuffer->initData((char *) log_path, strlen(log_path), compress_); logBuffer->map_buffer = map_buffer; + + env->ReleaseStringUTFChars(buffer_path_, buffer_path); + env->ReleaseStringUTFChars(log_path_, log_path); return reinterpret_cast(logBuffer); }