diff --git a/bindings/python/keystone/keystone.py b/bindings/python/keystone/keystone.py
index dbe667edb7097c765e4633e4e8a8e7b4268263bf..3e5c45a3b192c087873af5a2d5a223340360b518 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 515e7ab5104cf53fb3e70b5e5e10ac637aa5470f..9b4553dc56849d1ceda3a9343e07f96f126d9a2b 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 65c836c8f8189625a52114dae5240c7241994001..1341645beee668905d31298bb13ee68d564e8f31 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);
 }