[evolution-data-server] IMAPx: Correct ref/unref imbalance on a GConverter in/out base streams
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] IMAPx: Correct ref/unref imbalance on a GConverter in/out base streams
- Date: Thu, 2 Jul 2020 11:55:01 +0000 (UTC)
commit 5e6569908638e9523d495d78dc3aa24ee96d5cad
Author: Milan Crha <mcrha redhat com>
Date: Thu Jul 2 13:53:03 2020 +0200
IMAPx: Correct ref/unref imbalance on a GConverter in/out base streams
Both g_converter_input_stream_new() and g_converter_output_stream_new()
add its own reference on the base stream, thus the one used by the argument
should be removed, to avoid leak of the memory.
src/camel/providers/imapx/camel-imapx-server.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/camel/providers/imapx/camel-imapx-server.c b/src/camel/providers/imapx/camel-imapx-server.c
index 816c6e66e..7cbf5db82 100644
--- a/src/camel/providers/imapx/camel-imapx-server.c
+++ b/src/camel/providers/imapx/camel-imapx-server.c
@@ -2647,10 +2647,12 @@ imapx_server_set_streams (CamelIMAPXServer *is,
/* The logger produces debugging output. */
logger = camel_imapx_logger_new (is->priv->tagprefix);
- input_stream = g_converter_input_stream_new (
- input_stream, logger);
+ temp_stream = g_converter_input_stream_new (input_stream, logger);
+ g_object_unref (input_stream);
g_clear_object (&logger);
+ input_stream = temp_stream;
+
/* Buffer the input stream for parsing. */
temp_stream = camel_imapx_input_stream_new (input_stream);
camel_binding_bind_property (
@@ -2662,11 +2664,15 @@ imapx_server_set_streams (CamelIMAPXServer *is,
}
if (output_stream != NULL) {
+ GOutputStream *temp_stream;
+
/* The logger produces debugging output. */
logger = camel_imapx_logger_new (is->priv->tagprefix);
- output_stream = g_converter_output_stream_new (
- output_stream, logger);
+ temp_stream = g_converter_output_stream_new (output_stream, logger);
+ g_object_unref (output_stream);
g_clear_object (&logger);
+
+ output_stream = temp_stream;
}
g_mutex_lock (&is->priv->stream_lock);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]