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 935770c  THRIFT-5136: Fix memory leak in 
thrift_multiplexed_processor_process_impl() Client: c_glib Patch: wangyunjian 
<[email protected]>
935770c is described below

commit 935770c6b077fd96430684049078bdb9bdff50c5
Author: wangyunjian <[email protected]>
AuthorDate: Sun Mar 8 17:31:21 2020 +0800

    THRIFT-5136: Fix memory leak in thrift_multiplexed_processor_process_impl()
    Client: c_glib
    Patch: wangyunjian <[email protected]>
    
    This closes #2052
    
    Signed-off-by: wangyunjian <[email protected]>
---
 .../src/thrift/c_glib/processor/thrift_multiplexed_processor.c    | 8 ++------
 .../src/thrift/c_glib/protocol/thrift_stored_message_protocol.c   | 2 +-
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git 
a/lib/c_glib/src/thrift/c_glib/processor/thrift_multiplexed_processor.c 
b/lib/c_glib/src/thrift/c_glib/processor/thrift_multiplexed_processor.c
index 12a24a7..7a5600c 100644
--- a/lib/c_glib/src/thrift/c_glib/processor/thrift_multiplexed_processor.c
+++ b/lib/c_glib/src/thrift/c_glib/processor/thrift_multiplexed_processor.c
@@ -215,13 +215,9 @@ thrift_multiplexed_processor_process_impl (ThriftProcessor 
*processor, ThriftPro
 
   }
 
-  /*
-  FIXME This makes everything fail, I don't know why.
-  if(stored_message_protocol!=NULL){
-         // After its use we must free it
-         g_object_unref(stored_message_protocol);
+  if (stored_message_protocol != NULL) {
+      g_object_unref (stored_message_protocol);
   }
-  */
   return retval;
 }
 
diff --git 
a/lib/c_glib/src/thrift/c_glib/protocol/thrift_stored_message_protocol.c 
b/lib/c_glib/src/thrift/c_glib/protocol/thrift_stored_message_protocol.c
index 22aca8a..6f1586f 100644
--- a/lib/c_glib/src/thrift/c_glib/protocol/thrift_stored_message_protocol.c
+++ b/lib/c_glib/src/thrift/c_glib/protocol/thrift_stored_message_protocol.c
@@ -55,7 +55,7 @@ thrift_stored_message_protocol_read_message_begin 
(ThriftProtocol *protocol,
   ThriftStoredMessageProtocol *self = THRIFT_STORED_MESSAGE_PROTOCOL 
(protocol);
 
   /* We return the stored values on construction */
-  *name = self->name;
+  *name = g_strdup (self->name);
   *message_type = self->mtype;
   *seqid = self->seqid;
 

Reply via email to