[
https://issues.apache.org/jira/browse/THRIFT-2016?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jens Geyer closed THRIFT-2016.
------------------------------
Resolution: Incomplete
Closed, not suitable in its current form. Please reopen if you have any updates
on this matter.
> 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
> Labels: patch
> Attachments: thrift-jira-thrift-2016_resource_leak.patch
>
>
> 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 was sent by Atlassian JIRA
(v6.2#6252)