diff options
author | Gerhard Sittig <gerhard.sittig@gmx.net> | 2021-03-07 07:03:18 +0100 |
---|---|---|
committer | Gerhard Sittig <gerhard.sittig@gmx.net> | 2021-03-07 07:03:18 +0100 |
commit | 234cbf50152b7e007322c62ed6190ae6bff30a92 (patch) | |
tree | 48d7fe0f75ae63421a76e7118ba3112081a5935c /type_decoder.c | |
parent | 2ee740fd9e5197bc9951a0c92e35947203c1b620 (diff) | |
download | libsigrokdecode-234cbf50152b7e007322c62ed6190ae6bff30a92.tar.gz libsigrokdecode-234cbf50152b7e007322c62ed6190ae6bff30a92.zip |
decoder: increment Python object reference for .has_channel() result
This fixes bug #1671.
Reported-By: Ivan Wick
Diffstat (limited to 'type_decoder.c')
-rw-r--r-- | type_decoder.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/type_decoder.c b/type_decoder.c index 9508183..b57b606 100644 --- a/type_decoder.c +++ b/type_decoder.c @@ -1100,6 +1100,7 @@ static PyObject *Decoder_has_channel(PyObject *self, PyObject *args) int idx, count; struct srd_decoder_inst *di; PyGILState_STATE gstate; + PyObject *bool_ret; if (!self || !args) return NULL; @@ -1130,7 +1131,9 @@ static PyObject *Decoder_has_channel(PyObject *self, PyObject *args) PyGILState_Release(gstate); - return (di->dec_channelmap[idx] == -1) ? Py_False : Py_True; + bool_ret = (di->dec_channelmap[idx] == -1) ? Py_False : Py_True; + Py_INCREF(bool_ret); + return bool_ret; err: PyGILState_Release(gstate); |