[evolution/gnome-3-10] EHttpRequest: Avoid possible data stream memory leak



commit 2af5c2524f8c85275e1afcabb87cef0cc34fc367
Author: Milan Crha <mcrha redhat com>
Date:   Fri Jan 31 14:03:35 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 8491f87..c183601 100644
--- a/mail/e-http-request.c
+++ b/mail/e-http-request.c
@@ -264,7 +264,7 @@ handle_http_request (GSimpleAsyncResult *res,
                        g_free (path);
 
                        /* Set result and quit the thread */
-                       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;
                } else {
@@ -428,7 +428,7 @@ handle_http_request (GSimpleAsyncResult *res,
                        uri, request->priv->content_type,
                        request->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;
        }
 
@@ -539,6 +539,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]