summaryrefslogtreecommitdiffstats
path: root/bindings
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-10-21 22:54:03 +0200
committerDavid Robillard <d@drobilla.net>2019-10-21 22:54:03 +0200
commit8cdca14b692a052bac143d165dfc0a15a3f11e3e (patch)
tree3fa719de2384affa893a908dd2a13ce674f00fcc /bindings
parent884d4131f636d637274f077abc3f0387307af820 (diff)
downloadlilv-8cdca14b692a052bac143d165dfc0a15a3f11e3e.tar.gz
lilv-8cdca14b692a052bac143d165dfc0a15a3f11e3e.tar.bz2
lilv-8cdca14b692a052bac143d165dfc0a15a3f11e3e.zip
Fix Python memory leaks
Diffstat (limited to 'bindings')
-rw-r--r--bindings/python/lilv.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/bindings/python/lilv.py b/bindings/python/lilv.py
index cc4101e..47179c5 100644
--- a/bindings/python/lilv.py
+++ b/bindings/python/lilv.py
@@ -1342,11 +1342,13 @@ class World(Structure):
return subject.get_symbol()
uri = _as_uri(subject)
+ ret = ""
if uri is not None:
node = c.world_get_symbol(self.world, uri.node)
- return c.node_as_string(node).decode("ascii") if node else ""
+ ret = c.node_as_string(node).decode("ascii") if node else ""
+ c.node_free(node)
- return ""
+ return ret
def new_uri(self, uri):
"""Create a new URI node."""
@@ -1400,6 +1402,10 @@ class Instance(Structure):
self.rate = rate
self.instance = c.plugin_instantiate(plugin.plugin, rate, features)
+ def __del__(self):
+ if hasattr(self, "instance"):
+ c.instance_free(self.instance[0])
+
def get_uri(self):
"""Get the URI of the plugin which `instance` is an instance of.