From: Marcus Comstedt Date: Sun, 26 Feb 2017 11:52:12 +0000 (+0100) Subject: Fix refcounting bug in set_new_condition_list() X-Git-Tag: libsigrokdecode-0.5.0~77 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=066fbafdc3ba734a73b5f7fcfa1dbae67ddebf8a;p=libsigrokdecode.git Fix refcounting bug in set_new_condition_list() py_conditionlist is an owned reference (it gets passed to Py_DecRef() at the end), so we need to increment the refcount when assigning it from the borrowed reference py_conds. --- diff --git a/type_decoder.c b/type_decoder.c index 0858098..9481bdb 100644 --- a/type_decoder.c +++ b/type_decoder.c @@ -535,6 +535,7 @@ static int set_new_condition_list(PyObject *self, PyObject *args) num_conditions = PyList_Size(py_conditionlist); if (num_conditions == 0) return 9999; /* The PD invoked self.wait([]). */ + Py_IncRef(py_conditionlist); } else if (PyDict_Check(py_conds)) { /* 'py_conds' is a dict. */ if (PyDict_Size(py_conds) == 0)