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.
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 @@
<< 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
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 @@
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,