You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by xu...@apache.org on 2026/05/17 17:24:40 UTC

(opendal) branch main updated: fix(binding/go): correct entry free ffi signature (#7538)

This is an automated email from the ASF dual-hosted git repository.

Xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git


The following commit(s) were added to refs/heads/main by this push:
     new 16133970c fix(binding/go): correct entry free ffi signature (#7538)
16133970c is described below

commit 16133970ceb26a422f5ffe052cf2db63beeb18f2
Author: Xuanwo <gi...@xuanwo.io>
AuthorDate: Mon May 18 01:24:33 2026 +0800

    fix(binding/go): correct entry free ffi signature (#7538)
---
 bindings/c/tests/test_suites_list.cpp | 2 +-
 bindings/go/lister.go                 | 2 +-
 bindings/go/string_ownership_test.go  | 8 ++++++++
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/bindings/c/tests/test_suites_list.cpp b/bindings/c/tests/test_suites_list.cpp
index 9fa634455..12c291462 100644
--- a/bindings/c/tests/test_suites_list.cpp
+++ b/bindings/c/tests/test_suites_list.cpp
@@ -335,7 +335,7 @@ void test_entry_metadata(opendal_test_context* ctx)
         }
 
         opendal_metadata_free(meta);
-        free(path);
+        opendal_string_free(path);
         opendal_entry_free(next_result.entry);
     }
 
diff --git a/bindings/go/lister.go b/bindings/go/lister.go
index 591ab8a1b..9d7943dea 100644
--- a/bindings/go/lister.go
+++ b/bindings/go/lister.go
@@ -359,7 +359,7 @@ var ffiListerNext = newFFI(ffiOpts{
 
 var ffiEntryFree = newFFI(ffiOpts{
 	sym:    "opendal_entry_free",
-	rType:  &ffi.TypePointer,
+	rType:  &ffi.TypeVoid,
 	aTypes: []*ffi.Type{&ffi.TypePointer},
 }, func(ctx context.Context, ffiCall ffiCall) func(e *opendalEntry) {
 	return func(e *opendalEntry) {
diff --git a/bindings/go/string_ownership_test.go b/bindings/go/string_ownership_test.go
index 65fe7782d..65da9ecbe 100644
--- a/bindings/go/string_ownership_test.go
+++ b/bindings/go/string_ownership_test.go
@@ -23,8 +23,16 @@ import (
 	"context"
 	"testing"
 	"unsafe"
+
+	"github.com/jupiterrider/ffi"
 )
 
+func TestEntryFreeUsesVoidReturnType(t *testing.T) {
+	if ffiEntryFree.opts.rType != &ffi.TypeVoid {
+		t.Fatalf("ffiEntryFree return type = %v, want void", ffiEntryFree.opts.rType)
+	}
+}
+
 func TestCopyCStringAndFreeNil(t *testing.T) {
 	var freed int
 	freeCString := func(*byte) {