You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "kuldeep gupta (JIRA)" <ji...@apache.org> on 2013/08/03 12:29:48 UTC
[jira] [Updated] (THRIFT-2016) Resource Leak in thrift struct under
compiler/cpp/src/parse/t_function.h
[ https://issues.apache.org/jira/browse/THRIFT-2016?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
kuldeep gupta updated THRIFT-2016:
----------------------------------
Patch Info: Patch Available
Remaining Estimate: (was: 96h)
Original Estimate: (was: 96h)
> Resource Leak in thrift struct under compiler/cpp/src/parse/t_function.h
> ------------------------------------------------------------------------
>
> Key: THRIFT-2016
> URL: https://issues.apache.org/jira/browse/THRIFT-2016
> 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
>
> In file compiler/cpp/src/parse/t_function.h
> class t_function : public t_doc {
> 35 public:
> 36 t_function(t_type* returntype,
> 37 std::string name,
> 38 t_struct* arglist,
> 39 bool oneway=false) :
> 40 returntype_(returntype),
> 41 name_(name),
> 42 arglist_(arglist),
> 43 oneway_(oneway) {
> 44 xceptions_ = new t_struct(NULL);
> In Line number 44
> 1. Allocating memory by calling "new t_struct(NULL)".
> 2. Assigning "this->xceptions_" = "new t_struct(NULL)".
> 3. The constructor allocates field "xceptions_" of "t_function" but the destructor and whatever functions it calls do not free it.
> 45 }
> This is the destructor implementation.
> 63 ~t_function() {}
> destructor should deallocate memroy for xceptions_. but destructor implementation does not do resource deallocation.
> which sometimes causes Resource Leak.
> Possible patch:
> ~t_function() {
> delete xceptions_;
> xceptions_ = 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