THRIFT-5136: Fix memory leak in thrift_multiplexed_processor_process_impl()
Client: c_glib
Patch: wangyunjian <wangyunjian@huawei.com>
This closes #2052
Signed-off-by: wangyunjian <wangyunjian@huawei.com>
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 @@
}
- /*
- 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 @@
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;