rename API uc_mem_free() to uc_free(). see #662
This commit is contained in:
@@ -17,7 +17,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_mem_free(*p) })
|
||||
runtime.SetFinalizer(ctx, func(p Context) { C.uc_free(*p) })
|
||||
if err := errReturn(C.uc_context_save(u.handle, *ctx)); err != nil {
|
||||
}
|
||||
return ctx, nil
|
||||
|
||||
@@ -117,7 +117,7 @@ instance Storable MemoryRegion where
|
||||
|
||||
-- | Opaque storage for CPU context, used with the context functions.
|
||||
{# pointer *uc_context as Context
|
||||
foreign finalizer uc_mem_free_wrapper as memFree
|
||||
foreign finalizer uc_free_wrapper as memFree
|
||||
newtype
|
||||
#}
|
||||
|
||||
@@ -125,7 +125,7 @@ instance Storable MemoryRegion where
|
||||
{# pointer *uc_context as ContextPtr -> Context #}
|
||||
|
||||
-- | Make a CPU context out of a context pointer. The returned CPU context will
|
||||
-- automatically call 'uc_mem_free' when it goes out of scope.
|
||||
-- automatically call 'uc_free' when it goes out of scope.
|
||||
mkContext :: ContextPtr
|
||||
-> IO Context
|
||||
mkContext ptr =
|
||||
|
||||
@@ -7,6 +7,6 @@ void uc_close_wrapper(uc_engine *uc) {
|
||||
void uc_close_dummy(uc_engine *uc) {
|
||||
}
|
||||
|
||||
void uc_mem_free_wrapper(void *mem) {
|
||||
uc_mem_free(mem);
|
||||
void uc_free_wrapper(void *mem) {
|
||||
uc_free(mem);
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@ void uc_close_wrapper(uc_engine *uc);
|
||||
void uc_close_dummy(uc_engine *uc);
|
||||
|
||||
/*
|
||||
* Wrap Unicorn's uc_mem_free function and ignore the returned error code.
|
||||
* Wrap Unicorn's uc_free function and ignore the returned error code.
|
||||
*/
|
||||
void uc_mem_free_wrapper(void *context);
|
||||
void uc_free_wrapper(void *context);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -746,7 +746,7 @@ JNIEXPORT jlong JNICALL Java_unicorn_Unicorn_context_1alloc
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_unicorn_Unicorn_context_1free
|
||||
(JNIEnv *env, jobject self, jlong ctx) {
|
||||
uc_err err = uc_mem_free((void *)ctx);
|
||||
uc_err err = uc_free((void *)ctx);
|
||||
if (err != UC_ERR_OK) {
|
||||
throwException(env, err);
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ _setup_prototype(_uc, "uc_mem_unmap", ucerr, uc_engine, ctypes.c_uint64, ctypes.
|
||||
_setup_prototype(_uc, "uc_mem_protect", ucerr, uc_engine, ctypes.c_uint64, ctypes.c_size_t, ctypes.c_uint32)
|
||||
_setup_prototype(_uc, "uc_query", ucerr, uc_engine, ctypes.c_uint32, ctypes.POINTER(ctypes.c_size_t))
|
||||
_setup_prototype(_uc, "uc_context_alloc", ucerr, uc_engine, ctypes.POINTER(uc_context))
|
||||
_setup_prototype(_uc, "uc_mem_free", ucerr, ctypes.c_void_p)
|
||||
_setup_prototype(_uc, "uc_free", ucerr, ctypes.c_void_p)
|
||||
_setup_prototype(_uc, "uc_context_save", ucerr, uc_engine, uc_context)
|
||||
_setup_prototype(_uc, "uc_context_restore", ucerr, uc_engine, uc_context)
|
||||
|
||||
@@ -496,7 +496,7 @@ class SavedContext(object):
|
||||
self.pointer = pointer
|
||||
|
||||
def __del__(self):
|
||||
status = _uc.uc_mem_free(self.pointer)
|
||||
status = _uc.uc_free(self.pointer)
|
||||
if status != uc.UC_ERR_OK:
|
||||
raise UcError(status)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user