mirror of
https://github.com/yuzu-emu/unicorn
synced 2024-11-24 07:38:11 +00:00
go: fix uc_free, free uc_mem_regions pointer
This commit is contained in:
parent
bc569f5a54
commit
ab3828222a
2 changed files with 3 additions and 1 deletions
|
@ -2,6 +2,7 @@ package unicorn
|
|||
|
||||
import (
|
||||
"runtime"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// #include <unicorn/unicorn.h>
|
||||
|
@ -17,7 +18,7 @@ func (u *uc) ContextSave(reuse Context) (Context, error) {
|
|||
if err := errReturn(C.uc_context_alloc(u.handle, ctx)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
runtime.SetFinalizer(ctx, func(p Context) { C.uc_free(*p) })
|
||||
runtime.SetFinalizer(ctx, func(p Context) { C.uc_free(unsafe.Pointer(*p)) })
|
||||
if err := errReturn(C.uc_context_save(u.handle, *ctx)); err != nil {
|
||||
}
|
||||
return ctx, nil
|
||||
|
|
|
@ -178,6 +178,7 @@ func (u *uc) MemRegions() ([]*MemRegion, error) {
|
|||
Prot: int(v.perms),
|
||||
}
|
||||
}
|
||||
C.uc_free(unsafe.Pointer(regions))
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue