Yes, I've done the same except that I've used Py_DECREF since the references are guarded by previous non null tests.

https://svn.apache.org/repos/asf/httpd/mod_python/trunk/src/util.c

Regards,
Nicolas

2006/7/9, Harold J. Ship <Harold@giant-steps-networks.com>:
Just to be sure, this is the change I've made to util.c (marked with @HJS):
 
    while (dir) {
 
        PyObject *t = Py_BuildValue("(s, s)", dir->directive, dir->args);
        if (!t)
            return PyErr_NoMemory();
 
        PyList_Append(list, t);
        Py_XDECREF(t); // @HJS
 
        if (dir->first_child) {
 
            PyObject *child = cfgtree_walk(dir->first_child);
            if (!child)
                return PyErr_NoMemory();
 
            PyList_Append(list, child);
            Py_XDECREF(child); // @HJS
 
        }
 
        dir = dir->next;
    }


From: nicolas.lehuen@gmail.com [mailto:nicolas.lehuen@gmail.com] On Behalf Of Nicolas Lehuen
Sent: Sunday, July 09, 2006 11:46 AM
To: Harold J. Ship
Cc: python-dev@httpd.apache.org
Subject: Re: Commented: (MODPYTHON-172) Memory leak with util.fieldstorage using mod_python 3.2.8 on apache 2.0.55

OK, I'm currently checking in the fixes you suggested on the trunk. Too bad we cannot write a unit test that checks for memory leaks.

Jim, Graham, what shall we do for the 3.2.9 release ? Shall we keep on with the current branch or backport the fixes ?

Regards,
Nicolas

2006/7/9, Harold Ship <harold@giant-steps-networks.com>:

I've made a test build based on 3.2.8 release, where I've added Py_XDECREF()
calls in parse_qsl(), cfgtree_walk() TWICE (one on t, one on child), and
req_readlines().

My foo/bar program doesn't leak, and I'm now testing my full application. So
far, it seems to be ok.


Harold