The node list returned by the Python HA status API is leaked

The node list returned by the Python HA status API is not garbage collected. This small program is written to show the issue:

import gc
import socket
import _confd

ip = "127.0.0.1"
secret = "3009c19168a3a2e4"


def run():
    """Get ConfD's HA status."""
    m_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0)
    _confd.ha.connect(m_sock, secret, ip, _confd.CONFD_PORT)
    _, node_list = _confd.ha.status(m_sock)
    print "_confd.ha.status() returned '%s'" % node_list


def mem():
    """Garbage collect and see if node_list is still tracked."""
    gc.collect()
    objs = gc.get_objects()
    print "gc.get_objects() returned"
    for obj in objs:
        if isinstance(obj, list) and obj:
            obj0 = obj[0]
            if isinstance(obj0, dict) and obj0.get("nodeid") and obj0.get("address"):
                print "'%s'" % obj


if __name__ == "__main__":
    run(); run(); run()
    mem()

The execution of this program shows that the node list is still tracked after the garbage collector has executed:

_confd.ha.status() returned '[{'nodeid': 'confd-master', 'address': '60.60.60.34'}]'
_confd.ha.status() returned '[{'nodeid': 'confd-master', 'address': '60.60.60.34'}]'
_confd.ha.status() returned '[{'nodeid': 'confd-master', 'address': '60.60.60.34'}]'
gc.get_objects() returned
'[{'nodeid': 'confd-master', 'address': '60.60.60.34'}]'
'[{'nodeid': 'confd-master', 'address': '60.60.60.34'}]'
'[{'nodeid': 'confd-master', 'address': '60.60.60.34'}]'