[evolution] EHttpRequest: Avoid possible data stream memory leak



commit 2acd31fe1c847b3794a116f5e365868e999db3c8
Author: Milan Crha <mcrha redhat com>
Date:   Fri Jan 31 13:59:23 2014 +0100

    EHttpRequest: Avoid possible data stream memory leak
    
    The request's finish function is not called in case when the request
    is cancelled, which meant that the whole data stream was leaked.

 mail/e-http-request.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/mail/e-http-request.c b/mail/e-http-request.c
index c85a268..534e30b 100644
--- a/mail/e-http-request.c
+++ b/mail/e-http-request.c
@@ -283,7 +283,7 @@ handle_http_request (GSimpleAsyncResult *res,
 
                        /* Set result and quit the thread */
                        g_simple_async_result_set_op_res_gpointer (
-                               res, stream, NULL);
+                               res, stream, g_object_unref);
 
                        goto cleanup;
                } else {
@@ -446,7 +446,7 @@ handle_http_request (GSimpleAsyncResult *res,
                        uri, priv->content_type,
                        priv->content_length, uri_md5));
 
-               g_simple_async_result_set_op_res_gpointer (res, stream, NULL);
+               g_simple_async_result_set_op_res_gpointer (res, stream, g_object_unref);
 
                goto cleanup;
        }
@@ -541,6 +541,8 @@ http_request_send_finish (SoupRequest *request,
 
        if (!stream) /* We must always return something */
                stream = g_memory_input_stream_new ();
+       else
+               g_object_ref (stream);
 
        return stream;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]