xbmc/xbmc — pull request #4290 by dgburr (2014-02-28 04:33:14+00:00)
Title: Fix memory leakage in python bindings

The python bindings generated by the groovy code generator contain a reference counting bug which results in a memory leak whenever a std::vector is converted to a python list. The following member functions are affected:

* xbmcvfs.listdir
* xbmc.Player.getAvailableSubtitleStreams
* xbmc.Player.getAvailableAudioStreams
* xbmcgui.Control.getPosition
* xbmcgui.Dialog.browse
* xbmcgui.Dialog.browseMultiple

The reference counting bug occurs because PyList_Append() increments the reference count of the item, so the caller needs to call Py_DECREF() because it no longer owns the object.

This bug is especially problematic when running the Watchdog Service Addon since it may result in frequent calls to xbmcvfs.listdir, and each call can leak many kilobytes of data when listing directories containing many files.