From 41c9d1c9777a1156630ce4b237d0f811bb658a71 Mon Sep 17 00:00:00 2001 From: Adrian Herrera <adrian.herrera02@gmail.com> Date: Sun, 5 Jun 2016 12:29:27 +1000 Subject: [PATCH] Changed argument type for the ks_free function * ks_free: The 'p' argument should have type unsigned char* to match the type of the 'encoding' argument to ks_asm --- bindings/python/keystone/keystone.py | 4 ++-- include/keystone/keystone.h | 2 +- llvm/keystone/ks.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bindings/python/keystone/keystone.py b/bindings/python/keystone/keystone.py index dbe667e..3e5c45a 100644 --- a/bindings/python/keystone/keystone.py +++ b/bindings/python/keystone/keystone.py @@ -100,10 +100,10 @@ _setup_prototype(_ks, "ks_open", kserr, c_uint, c_uint, POINTER(ks_engine)) _setup_prototype(_ks, "ks_close", kserr, ks_engine) _setup_prototype(_ks, "ks_strerror", c_char_p, kserr) _setup_prototype(_ks, "ks_errno", kserr, ks_engine) -_setup_prototype(_ks, "ks_option", kserr, ks_engine, c_int, c_void_p) +_setup_prototype(_ks, "ks_option", kserr, ks_engine, c_int, c_size_t) # int ks_asm(ks_engine *ks, const char *string, uint64_t address, unsigned char **encoding, size_t *encoding_size, size_t *stat_count); _setup_prototype(_ks, "ks_asm", c_int, ks_engine, c_char_p, c_uint64, POINTER(POINTER(c_ubyte)), POINTER(c_size_t), POINTER(c_size_t)) -_setup_prototype(_ks, "ks_free", None, c_void_p) +_setup_prototype(_ks, "ks_free", None, POINTER(c_ubyte)) # access to error code via @errno of KsError diff --git a/include/keystone/keystone.h b/include/keystone/keystone.h index 515e7ab..9b4553d 100644 --- a/include/keystone/keystone.h +++ b/include/keystone/keystone.h @@ -302,7 +302,7 @@ int ks_asm(ks_engine *ks, @p: memory allocated in @encoding argument of ks_asm() */ KEYSTONE_EXPORT -void ks_free(void *p); +void ks_free(unsigned char *p); #ifdef __cplusplus diff --git a/llvm/keystone/ks.cpp b/llvm/keystone/ks.cpp index 65c836c..1341645 100644 --- a/llvm/keystone/ks.cpp +++ b/llvm/keystone/ks.cpp @@ -511,7 +511,7 @@ ks_err ks_option(ks_engine *ks, ks_opt_type type, size_t value) KEYSTONE_EXPORT -void ks_free(void *p) +void ks_free(unsigned char *p) { free(p); } -- GitLab