Skip to content

Commit

Permalink
delete[] when failed to unbox
Browse files Browse the repository at this point in the history
  • Loading branch information
rushiiMachine committed Aug 28, 2024
1 parent 67834a9 commit 7baa88c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/src/main/cpp/invoke_constructor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,12 @@ bool InvokeConstructorWithArgs(JNIEnv *env, jobject instance, jobject constructo
if (env->ExceptionOccurred()) return false;

auto* unboxedArgs = new jvalue[argsCount];
if (!unboxArgs(env, constructor, args, argsCount, unboxedArgs)) return false;
if (!unboxArgs(env, constructor, args, argsCount, unboxedArgs)) {
delete[] unboxedArgs;
return false;
}

env->CallVoidMethodA(instance, constructorMethodId, unboxedArgs);

delete[] unboxedArgs;
return !env->ExceptionOccurred();
}
Expand Down

0 comments on commit 7baa88c

Please sign in to comment.