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

Hudson commented on THRIFT-2017:
--------------------------------

FAILURE: Integrated in Thrift #834 (See 
[https://builds.apache.org/job/Thrift/834/])
THRIFT-2017 Resource Leak in thrift struct under 
compiler/cpp/src/parse/t_program.h (jensg: rev 
09b97c78de58fea61b5dc90bd56095515bdd4f02)
* compiler/cpp/src/parse/t_program.h

                
> Resource Leak in thrift struct under compiler/cpp/src/parse/t_program.h
> -----------------------------------------------------------------------
>
>                 Key: THRIFT-2017
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2017
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Compiler
>    Affects Versions: 0.9
>         Environment: cpp compiler of thrift 0.9.0 on Linux 
> 2.6.32-220.el6.x86_64
>            Reporter: kuldeep gupta
>              Labels: patch
>             Fix For: 0.9.1
>
>         Attachments: thrift-jira-thrift-2017_resource_leak.patch
>
>
> In file compiler/cpp/src/parse/t_program.h
> class t_program : public t_doc {
>   59  public:
>   60   t_program(std::string path, std::string name) :
>   61     path_(path),
>   62     name_(name),
>   63     out_path_("./"),
>   64     out_path_is_absolute_(false) {
>   65     scope_ = new t_scope();
>   66   }
>   67 
>   68   t_program(std::string path) :
>   69     path_(path),
>   70     out_path_("./"),
>   71     out_path_is_absolute_(false) {
>   72     name_ = program_name(path);
>   73     scope_ = new t_scope();
>   74   }
> In Above code at line number 65 and 73 Resource leaks happens as
> 1. Allocating memory by calling "new t_scope". 
> 2. Assigning: "this->scope_" = "new t_scope". 
> 3. The constructor allocates field "scope_" of "t_program" but there is no 
> destructor in the code.
> destructor should deallocate memroy for t_scope. 
> which sometimes causes Resource Leak.
> Possible patch:
> There should be destructor to release the resources allocated dynamically.
> ~t_program() {
>  delete scope_; scope_ = NULL; 
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to