[ 
https://issues.apache.org/jira/browse/THRIFT-1522?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14995667#comment-14995667
 ] 

Hudson commented on THRIFT-1522:
--------------------------------

SUCCESS: Integrated in Thrift #1716 (See 
[https://builds.apache.org/job/Thrift/1716/])
THRIFT-1522: Fixes Memory leak by wrapping getaddrinfo into a class. (nsuke: 
rev d8ddb775e4330050e04cefa711f60250905978d3)
* lib/cpp/src/thrift/transport/TServerSocket.cpp


> TServerSocket potential memory leak with addrinfo *res0
> -------------------------------------------------------
>
>                 Key: THRIFT-1522
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1522
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.8
>         Environment: Unix, Windows
>            Reporter: Peace C
>            Priority: Minor
>              Labels: TServerSocket, leak, memory, thrift
>             Fix For: 1.0
>
>
> I noticed a potential memory leak in TServerSocket.cpp. The res0 pointer 
> receives an allocation from getaddrinfo() but is only freed part of the time 
> in a conditional branch. It should be outside of the if-else to ensure it's 
> deallocated every time.
> I'm holding off on creating a patch in case I'm not understanding some hidden 
> functionality in the socket library. Here is the code snippet:
>   struct addrinfo *res0;
>   ...
>   getaddrinfo(NULL, port, &hints, &res0);
>   ...
>   if (! path_.empty())
>   { ... }
>   else
>   {
>     ...
>     freeaddrinfo(res0); //Line 331 of TServerSocket.cpp
>   }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to