diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2007-01-05 15:12:38 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2007-01-05 15:12:38 +0000 |
| commit | 999ddaa2a3953f5e16549483cd8deb021685fc5b (patch) | |
| tree | 09cdc8785eb1b6f5ffe4d6159bc7cbb39d90ec7b /lib/dvb/pmt.cpp | |
| parent | 5264f2cd003271ba2c426e21d62d13025dba177b (diff) | |
| download | enigma2-999ddaa2a3953f5e16549483cd8deb021685fc5b.tar.gz enigma2-999ddaa2a3953f5e16549483cd8deb021685fc5b.zip | |
fix refcounts
Diffstat (limited to 'lib/dvb/pmt.cpp')
| -rw-r--r-- | lib/dvb/pmt.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/lib/dvb/pmt.cpp b/lib/dvb/pmt.cpp index 1b1455e4..7f560c8e 100644 --- a/lib/dvb/pmt.cpp +++ b/lib/dvb/pmt.cpp @@ -865,36 +865,42 @@ static PyObject *createTuple(int pid, const char *type) return r; } +static inline PyList_AppendSteal(PyObject *list, PyObject *item) +{ + PyList_Append(list, item); + Py_DECREF(item); +} + PyObject *eDVBServicePMTHandler::program::createPythonObject() { PyObject *r = PyDict_New(); PyObject *l = PyList_New(0); - PyList_Append(l, createTuple(0, "pat")); + PyList_AppendSteal(l, createTuple(0, "pat")); if (pmtPid != -1) - PyList_Append(l, createTuple(pmtPid, "pmt")); + PyList_AppendSteal(l, createTuple(pmtPid, "pmt")); for (std::vector<eDVBServicePMTHandler::videoStream>::const_iterator i(videoStreams.begin()); i != videoStreams.end(); ++i) - PyList_Append(l, createTuple(i->pid, "video")); + PyList_AppendSteal(l, createTuple(i->pid, "video")); for (std::vector<eDVBServicePMTHandler::audioStream>::const_iterator i(audioStreams.begin()); i != audioStreams.end(); ++i) - PyList_Append(l, createTuple(i->pid, "audio")); + PyList_AppendSteal(l, createTuple(i->pid, "audio")); for (std::vector<eDVBServicePMTHandler::subtitleStream>::const_iterator i(subtitleStreams.begin()); i != subtitleStreams.end(); ++i) - PyList_Append(l, createTuple(i->pid, "subtitle")); + PyList_AppendSteal(l, createTuple(i->pid, "subtitle")); - PyList_Append(l, createTuple(pcrPid, "pcr")); + PyList_AppendSteal(l, createTuple(pcrPid, "pcr")); if (textPid != -1) - PyList_Append(l, createTuple(textPid, "text")); + PyList_AppendSteal(l, createTuple(textPid, "text")); PyDict_SetItemString(r, "pids", l); return r; |
