]> sigrok.org Git - libsigrokdecode.git/commitdiff
Fix refcounting bug in set_new_condition_list()
authorMarcus Comstedt <redacted>
Sun, 26 Feb 2017 11:52:12 +0000 (12:52 +0100)
committerUwe Hermann <redacted>
Sun, 26 Feb 2017 13:56:56 +0000 (14:56 +0100)
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.

type_decoder.c

index 08580980070fe0ee10c654d7cafde315d7c9a3f8..9481bdb409feebf83d74bc40ad45107f3c034c08 100644 (file)
@@ -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)