You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by je...@apache.org on 2020/06/27 13:25:40 UTC

[thrift] branch master updated: THRIFT-5144: Fix memory leak when generate deserialize list element Client: c_glib Patch: wangyunjian

This is an automated email from the ASF dual-hosted git repository.

jensg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git


The following commit(s) were added to refs/heads/master by this push:
     new 86cc6f0  THRIFT-5144: Fix memory leak when generate deserialize list element Client: c_glib Patch: wangyunjian
86cc6f0 is described below

commit 86cc6f095c5943cb382e5ef0e5cf889c6e09bd86
Author: wangyunjian <wa...@huawei.com>
AuthorDate: Sat Mar 21 22:34:02 2020 +0800

    THRIFT-5144: Fix memory leak when generate deserialize list element
    Client: c_glib
    Patch: wangyunjian
    
    This closes #2064
    
    Signed-off-by: wangyunjian <wa...@huawei.com>
---
 compiler/cpp/src/thrift/generate/t_c_glib_generator.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/compiler/cpp/src/thrift/generate/t_c_glib_generator.cc b/compiler/cpp/src/thrift/generate/t_c_glib_generator.cc
index 098cdb4..fb45dfa 100644
--- a/compiler/cpp/src/thrift/generate/t_c_glib_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_c_glib_generator.cc
@@ -4332,6 +4332,7 @@ void t_c_glib_generator::generate_deserialize_list_element(ostream& out,
     throw std::runtime_error("compiler error: list element type cannot be void");
   } else if (is_numeric(ttype)) {
     indent(out) << "g_array_append_vals (" << prefix << ", " << elem << ", 1);" << endl;
+    indent(out) << "g_free (" << elem << ");" << endl;
   } else {
     indent(out) << "g_ptr_array_add (" << prefix << ", " << elem << ");" << endl;
   }