[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] Free object after *Destroy in python bindings



The patch below fixes an issue in the python bindings with the
vir*Destroy methods. After the object is successfully destroyed,
the payload is cleared, using 'self._o = None'. This unfortunately
screws up virt object reference counts, as the payload should be 
free'd using the appropriate vir*Free function.

Thanks,
Cole
diff --git a/python/generator.py b/python/generator.py
index cb57bff..9421981 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -629,10 +629,10 @@ function_classes = {}
 function_classes["None"] = []
 
 function_post = {
-    'virDomainDestroy': "self._o = None",
-    'virNetworkDestroy': "self._o = None",
-    'virStoragePoolDestroy': "self._o = None",
-    'virStorageVolDestroy': "self._o = None",
+    'virDomainDestroy': "del(self)",
+    'virNetworkDestroy': "del(self)",
+    'virStoragePoolDestroy': "del(self)",
+    'virStorageVolDestroy': "del(self)",
 }
 
 # Functions returning an integral type which need special rules to

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]