cython: add __dealloc__ method to Cs class to free memory when destroying its object. this fixes a memleak bug
diff --git a/bindings/python/pyx/ccapstone.pxd b/bindings/python/pyx/ccapstone.pxd
index 8cbe818..f575985 100644
--- a/bindings/python/pyx/ccapstone.pxd
+++ b/bindings/python/pyx/ccapstone.pxd
@@ -37,7 +37,7 @@
 
     cs_err cs_open(cs_arch arch, cs_mode mode, csh *handle)
 
-    cs_err cs_close(csh handle)
+    cs_err cs_close(csh *handle)
 
     cs_err cs_errno(csh handle)
 
diff --git a/bindings/python/pyx/ccapstone.pyx b/bindings/python/pyx/ccapstone.pyx
index 69036f9..62c12b2 100644
--- a/bindings/python/pyx/ccapstone.pyx
+++ b/bindings/python/pyx/ccapstone.pyx
@@ -6,7 +6,7 @@
 
 _diet = cc.cs_support(capstone.CS_SUPPORT_DIET)
 
-class CsDetail:
+class CsDetail(object):
 
     def __init__(self, arch, raw_detail = None):
         if not raw_detail:
@@ -183,7 +183,7 @@
                 return op
 
 
-cdef class Cs:
+cdef class Cs(object):
 
     cdef cc.csh csh
     cdef object _cs
@@ -197,6 +197,15 @@
         self.csh = <cc.csh> _cs.csh.value
         self._cs = _cs
 
+
+    # destructor to be called automatically when object is destroyed.
+    def __dealloc__(self):
+        if self.csh:
+            status = cc.cs_close(&self.csh)
+            if status != capstone.CS_ERR_OK:
+                raise CsError(status)
+
+
     def disasm(self, code, addr, count=0):
         cdef cc.cs_insn *allinsn