Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/main/java/org/extism/sdk/LibExtism.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,5 +169,4 @@ Pointer extism_function_new(String name,
Pointer extism_plugin_cancel_handle(Pointer pluginPointer);
boolean extism_plugin_cancel(Pointer cancelHandle);
void extism_function_set_namespace(Pointer p, String name);
int strlen(Pointer s);
}
11 changes: 5 additions & 6 deletions src/main/java/org/extism/sdk/Plugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,14 @@ public Plugin(byte[] manifestBytes, boolean withWASI, HostFunction[] functions)
withWASI,
errormsg);
if (p == null) {
if (functions != null)
if (functions != null) {
for (int i = 0; i < functions.length; i++) {
LibExtism.INSTANCE.extism_function_free(functions[i].pointer);
LibExtism.INSTANCE.extism_function_free(functions[i].pointer);
}
int errlen = LibExtism.INSTANCE.strlen(errormsg[0]);
byte[] msg = new byte[errlen];
errormsg[0].read(0, msg, 0, errlen);
}
String msg = errormsg[0].getString(0);
LibExtism.INSTANCE.extism_plugin_new_error_free(errormsg[0]);
throw new ExtismException(new String(msg));
throw new ExtismException(msg);
}

this.functions = functions;
Expand Down