projects
/
qemu-gpiodev
/
libgpiod.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5da2e8d
)
bindings: python: fix a memory leak in Line.set_value()
author
Bartosz Golaszewski
<bartekgola@gmail.com>
Sun, 13 May 2018 21:25:06 +0000
(23:25 +0200)
committer
Bartosz Golaszewski
<bartekgola@gmail.com>
Mon, 14 May 2018 10:01:13 +0000
(12:01 +0200)
We're not collecting the bulk object we're creating in this method. Add
Py_DECREF() where needed.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
bindings/python/gpiodmodule.c
patch
|
blob
|
history
diff --git
a/bindings/python/gpiodmodule.c
b/bindings/python/gpiodmodule.c
index 9248616eef2172373436926e156826d21be09aec..0aecb2471c9c82920d5beb7aeeb919318e8f4da1 100644
(file)
--- a/
bindings/python/gpiodmodule.c
+++ b/
bindings/python/gpiodmodule.c
@@
-385,10
+385,13
@@
static PyObject *gpiod_Line_set_value(gpiod_LineObject *self, PyObject *args)
return NULL;
vals = Py_BuildValue("((O))", val);
- if (!vals)
+ if (!vals) {
+ Py_DECREF(bulk_obj);
return NULL;
+ }
ret = gpiod_LineBulk_set_values(bulk_obj, vals);
+ Py_DECREF(bulk_obj);
Py_DECREF(vals);
return ret;