s4-python: Properly call PyObject_Del from all destructors.
authorJelmer Vernooij <jelmer@samba.org>
Wed, 29 Dec 2010 14:58:12 +0000 (15:58 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Sat, 1 Jan 2011 01:54:05 +0000 (02:54 +0100)
lib/talloc/pytalloc.c
source4/lib/ldb/pyldb.c
source4/libnet/py_net.c

index 6ddcac988b0ba2d7123dac44c0afdd3bb05d5802..457358ed8f3a6f4f4163a8cccaf4181e6569b838 100644 (file)
@@ -94,7 +94,7 @@ static void py_talloc_dealloc(PyObject* self)
        py_talloc_Object *obj = (py_talloc_Object *)self;
        assert(talloc_unlink(NULL, obj->talloc_ctx) != -1);
        obj->talloc_ctx = NULL;
-       self->ob_type->tp_free(self);
+       PyObject_Del(self);
 }
 
 /**
index d67d53f98285fdd76062df041c2529801f956fe9..5446aafb92a1fd486c3f6f22503d65662a4d93c7 100644 (file)
@@ -358,7 +358,7 @@ static PyObject *py_ldb_dn_new(PyTypeObject *type, PyObject *args, PyObject *kwa
 static void py_ldb_dn_dealloc(PyLdbDnObject *self)
 {
        talloc_free(self->mem_ctx);
-       self->ob_type->tp_free(self);
+       PyObject_Del(self);
 }
 
 PyTypeObject PyLdbDn = {
@@ -1500,7 +1500,7 @@ static PyObject *PyLdb_FromLdbContext(struct ldb_context *ldb_ctx)
 static void py_ldb_dealloc(PyLdbObject *self)
 {
        talloc_free(self->mem_ctx);
-       self->ob_type->tp_free(self);
+       PyObject_Del(self);
 }
 
 PyTypeObject PyLdb = {
@@ -1694,7 +1694,7 @@ static PyMethodDef py_ldb_module_methods[] = {
 static void py_ldb_module_dealloc(PyLdbModuleObject *self)
 {
        talloc_free(self->mem_ctx);
-       self->ob_type->tp_free(self);
+       PyObject_Del(self);
 }
 
 PyTypeObject PyLdbModule = {
@@ -1985,7 +1985,7 @@ static PyObject *py_ldb_msg_element_str(PyLdbMessageElementObject *self)
 static void py_ldb_msg_element_dealloc(PyLdbMessageElementObject *self)
 {
        talloc_free(self->mem_ctx);
-       self->ob_type->tp_free(self);
+       PyObject_Del(self);
 }
 
 static PyTypeObject PyLdbMessageElement = {
@@ -2322,7 +2322,7 @@ static PyObject *py_ldb_msg_repr(PyLdbMessageObject *self)
 static void py_ldb_msg_dealloc(PyLdbMessageObject *self)
 {
        talloc_free(self->mem_ctx);
-       self->ob_type->tp_free(self);
+       PyObject_Del(self);
 }
 
 static int py_ldb_msg_compare(PyLdbMessageObject *py_msg1,
@@ -2394,7 +2394,7 @@ PyObject *PyLdbTree_FromTree(struct ldb_parse_tree *tree)
 static void py_ldb_tree_dealloc(PyLdbTreeObject *self)
 {
        talloc_free(self->mem_ctx);
-       self->ob_type->tp_free(self);
+       PyObject_Del(self);
 }
 
 PyTypeObject PyLdbTree = {
index 48cf4a416dcc5723bf289c1dd85326723fb13045..514f9dfe3c0a8c3e886c35a4f484269f22694573 100644 (file)
@@ -540,6 +540,7 @@ static PyMethodDef net_obj_methods[] = {
 static void py_net_dealloc(py_net_Object *self)
 {
        talloc_free(self->mem_ctx);
+       PyObject_Del(self);
 }
 
 static PyObject *net_obj_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)