[ 
https://issues.apache.org/jira/browse/MODPYTHON-211?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12613838#action_12613838
 ] 

Alex Cichowski commented on MODPYTHON-211:
------------------------------------------

The patch attached to MODPYTHON-222 includes a rewrite of readlines() that 
should fix this.

> Potential memory leak in req.readlines().
> -----------------------------------------
>
>                 Key: MODPYTHON-211
>                 URL: https://issues.apache.org/jira/browse/MODPYTHON-211
>             Project: mod_python
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.3.x, 3.2.10
>            Reporter: Graham Dumpleton
>
> This code in req.readlines() looks a bit fishy to me and possibly leaks 
> memory. The code in question is:
>     rlargs = PyTuple_New(0);
>     if (result == NULL)
>         return PyErr_NoMemory();
>     line = req_readline(self, rlargs);
>     while (line && ((linesize=PyString_Size(line))>0)) {
>         PyList_Append(result, line);
>         size += linesize;
>         if ((sizehint != -1) && (size >= sizehint))
>             break;
>         Py_DECREF(line);
>         line = req_readline(self, args);
>     }
>     Py_XDECREF(line);
> The thing that looks wrong is 'rlargs'. This is created, used in a sub call 
> to req_readline() but then never destroyed. Thus, possibly a memory leak.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to