You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ro...@apache.org on 2016/01/16 13:10:24 UTC

thrift git commit: THRIFT-3552 c_glib: Fix memory leak in processor

Repository: thrift
Updated Branches:
  refs/heads/master b815e3786 -> 420ee1e7f


THRIFT-3552 c_glib: Fix memory leak in processor

- t_c_glib_generator.cc: Free method-name string once matched within a
  generated dispatch_call implementation.
- thrift_dispatch_processor.c: Free method-name string in default
  dispatch_call implementation.


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/420ee1e7
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/420ee1e7
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/420ee1e7

Branch: refs/heads/master
Commit: 420ee1e7f877ee6e1e28abefa4c6eb41fcf3a2fe
Parents: b815e37
Author: Simon South <si...@simonsouth.com>
Authored: Thu Jan 14 05:32:02 2016 -0500
Committer: Roger Meier <ro...@apache.org>
Committed: Sat Jan 16 12:45:19 2016 +0100

----------------------------------------------------------------------
 compiler/cpp/src/generate/t_c_glib_generator.cc                   | 3 ++-
 .../src/thrift/c_glib/processor/thrift_dispatch_processor.c       | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/420ee1e7/compiler/cpp/src/generate/t_c_glib_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/generate/t_c_glib_generator.cc b/compiler/cpp/src/generate/t_c_glib_generator.cc
index 0eefeb6..affaafa 100644
--- a/compiler/cpp/src/generate/t_c_glib_generator.cc
+++ b/compiler/cpp/src/generate/t_c_glib_generator.cc
@@ -2584,7 +2584,8 @@ void t_c_glib_generator::generate_service_processor(t_service* tservice) {
              << indent() << "if (process_function_def != NULL)" << endl;
   scope_up(f_service_);
   args_indent = indent() + string(53, ' ');
-  f_service_ << indent() << "dispatch_result = "
+  f_service_ << indent() << "g_free (method_name);" << endl
+             << indent() << "dispatch_result = "
              << "(*process_function_def->function) (self," << endl
              << args_indent << "sequence_id," << endl
              << args_indent << "input_protocol," << endl

http://git-wip-us.apache.org/repos/asf/thrift/blob/420ee1e7/lib/c_glib/src/thrift/c_glib/processor/thrift_dispatch_processor.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/src/thrift/c_glib/processor/thrift_dispatch_processor.c b/lib/c_glib/src/thrift/c_glib/processor/thrift_dispatch_processor.c
index 57f0bed..57d6217 100644
--- a/lib/c_glib/src/thrift/c_glib/processor/thrift_dispatch_processor.c
+++ b/lib/c_glib/src/thrift/c_glib/processor/thrift_dispatch_processor.c
@@ -98,6 +98,7 @@ thrift_dispatch_processor_real_dispatch_call (ThriftDispatchProcessor *self,
                                            error) < 0)
     return FALSE;
   message = g_strconcat ("Invalid method name: '", fname, "'", NULL);
+  g_free (fname);
   xception =
     g_object_new (THRIFT_TYPE_APPLICATION_EXCEPTION,
                   "type",    THRIFT_APPLICATION_EXCEPTION_ERROR_UNKNOWN_METHOD,