Skip to content

Commit 27c814f

Browse files
committed
purego: fix string argument processing in RegisterFunc
Use the correct loop variable 'val' instead of 'v' when converting string arguments to C strings. This ensures each string argument is properly converted rather than repeatedly using the same outer scope variable.
1 parent 1f4c6dd commit 27c814f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

func.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ func RegisterFunc(fptr any, cfn uintptr) {
287287

288288
for j, val := range args[i:] {
289289
if val.Kind() == reflect.String {
290-
ptr := strings.CString(v.String())
290+
ptr := strings.CString(val.String())
291291
keepAlive = append(keepAlive, ptr)
292292
val = reflect.ValueOf(ptr)
293293
args[i+j] = val

0 commit comments

Comments
 (0)