[evolution-data-server/gnome-3-18] Fix a reference leak from e-webdav-discover



commit cc954e375a1bea0cec28c0a608d2c80bdb173282
Author: Milan Crha <mcrha redhat com>
Date:   Wed Sep 23 19:05:11 2015 +0200

    Fix a reference leak from e-webdav-discover
    
    The SoupMessage was never freed, which also holds a reference
    on an ESource, through e_soup_ssl_trust_connect(), thus leaking
    two objects at once.

 libedataserver/e-webdav-discover.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/libedataserver/e-webdav-discover.c b/libedataserver/e-webdav-discover.c
index 0fc13bf..0f9f73b 100644
--- a/libedataserver/e-webdav-discover.c
+++ b/libedataserver/e-webdav-discover.c
@@ -843,8 +843,10 @@ e_webdav_discover_get_calendar_collection_details (SoupSession *session,
        soup_uri_free (soup_uri);
 
        doc = e_webdav_discover_parse_xml (message, "multistatus", out_certificate_pem, 
out_certificate_errors, error);
-       if (!doc)
+       if (!doc) {
+               g_clear_object (&message);
                return FALSE;
+       }
 
        xp_ctx = xmlXPathNewContext (doc);
        xmlXPathRegisterNs (xp_ctx, XC ("D"), XC (NS_WEBDAV));
@@ -872,6 +874,8 @@ e_webdav_discover_get_calendar_collection_details (SoupSession *session,
        xmlXPathFreeContext (xp_ctx);
        xmlFreeDoc (doc);
 
+       g_clear_object (&message);
+
        return TRUE;
 }
 
@@ -1240,8 +1244,10 @@ e_webdav_discover_get_addressbook_collection_details (SoupSession *session,
        soup_uri_free (soup_uri);
 
        doc = e_webdav_discover_parse_xml (message, "multistatus", out_certificate_pem, 
out_certificate_errors, error);
-       if (!doc)
+       if (!doc) {
+               g_clear_object (&message);
                return FALSE;
+       }
 
        xp_ctx = xmlXPathNewContext (doc);
        xmlXPathRegisterNs (xp_ctx, XC ("D"), XC (NS_WEBDAV));
@@ -1269,6 +1275,8 @@ e_webdav_discover_get_addressbook_collection_details (SoupSession *session,
        xmlXPathFreeContext (xp_ctx);
        xmlFreeDoc (doc);
 
+       g_clear_object (&message);
+
        return TRUE;
 }
 


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