Commented: (MODPYTHON-211) Potential memory leak in
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Apache Server configuration support > Apache Mod-Python > Commented: (MODPYTHON-211) Potential memory leak in




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Commented: (MODPYTHON-211) Potential memory leak in  
Graham Dumpleton (JIRA)


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-19-07 06:16 AM


[ https://issues.apache.org/jira/brow...action_12465940 ]

Graham Dumpleton commented on MODPYTHON-211:
--------------------------------------------

The req.readlines() function also leaks memory when invalid arguments are su
pplied to the function. This is because of the code:

PyObject *result = PyList_New(0);

..

if (! PyArg_ParseTuple(args, "|l", &sizehint))
return NULL;

That is, it allocates a result array but doesn't destroy it when arguments c
ouldn't be decoded.

The result object isn't destroyed in a couple of other failure cases as well
, such as when rlargs can't be created or req.readline() sets an exception.

> 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, 3.2.10
>            Reporter: Graham Dumpleton
>
> This code in req.readlines() looks a bit fishy to me and possibly leaks me
mory. 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.






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 01:54 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register