[evolution-data-server] Fix few memory leaks



commit 66c2c5c1fc045d0c2b81554f91f95ac0edb30d18
Author: Milan Crha <mcrha redhat com>
Date:   Wed Feb 1 14:38:46 2012 +0100

    Fix few memory leaks

 calendar/backends/caldav/e-cal-backend-caldav.c |    6 ++++--
 calendar/backends/http/e-cal-backend-http.c     |    6 ++++--
 libedataserver/e-proxy.c                        |    9 ++++++++-
 3 files changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/calendar/backends/caldav/e-cal-backend-caldav.c b/calendar/backends/caldav/e-cal-backend-caldav.c
index 50cece5..b4ba3c9 100644
--- a/calendar/backends/caldav/e-cal-backend-caldav.c
+++ b/calendar/backends/caldav/e-cal-backend-caldav.c
@@ -2425,7 +2425,7 @@ initialize_backend (ECalBackendCalDAV *cbdav,
 	ECalBackend              *backend;
 	ESource                  *source;
 	const gchar		 *os_val;
-	const gchar               *uri;
+	gchar			 *uri;
 	gsize                     len;
 	const gchar              *refresh;
 	const gchar              *cache_dir;
@@ -2463,8 +2463,10 @@ initialize_backend (ECalBackendCalDAV *cbdav,
 		}
 
 		priv->uri = g_strconcat (proto, uri + 9, NULL);
+
+		g_free (uri);
 	} else {
-		priv->uri = g_strdup (uri);
+		priv->uri = uri;
 	}
 
 	if (priv->uri) {
diff --git a/calendar/backends/http/e-cal-backend-http.c b/calendar/backends/http/e-cal-backend-http.c
index 61fb4b5..c378f45 100644
--- a/calendar/backends/http/e-cal-backend-http.c
+++ b/calendar/backends/http/e-cal-backend-http.c
@@ -603,10 +603,12 @@ begin_retrieval_cb (ECalBackendHttp *cbhttp)
 	if (priv->uri == NULL) {
 		ESource *source = e_backend_get_source (E_BACKEND (cbhttp));
 		const gchar *secure_prop = e_source_get_property (source, "use_ssl");
+		gchar *uri = e_source_get_uri (source);
 
-		priv->uri = webcal_to_http_method (
-			e_source_get_uri (source),
+		priv->uri = webcal_to_http_method (uri,
 			(secure_prop && g_str_equal(secure_prop, "1")));
+
+		g_free (uri);
 	}
 
 	/* create the Soup session if not already created */
diff --git a/libedataserver/e-proxy.c b/libedataserver/e-proxy.c
index 9790f04..709a518 100644
--- a/libedataserver/e-proxy.c
+++ b/libedataserver/e-proxy.c
@@ -378,8 +378,10 @@ ep_need_proxy_http (EProxy *proxy,
 		/* This will never happen, since we have already called
 		 * soup_address_resolve_sync ().
 		*/
-		if (!so_addr)
+		if (!so_addr) {
+			g_object_unref (addr);
 			return TRUE;
+		}
 
 		if (so_addr->sa_family == AF_INET) {
 			struct in_addr in, *mask, *addr_in;
@@ -394,6 +396,7 @@ ep_need_proxy_http (EProxy *proxy,
 						   in.s_addr, mask->s_addr, addr_in->s_addr));
 					if ((in.s_addr & mask->s_addr) == addr_in->s_addr) {
 						d(g_print ("Host [%s] doesn't require proxy\n", host));
+						g_object_unref (addr);
 						return FALSE;
 					}
 				}
@@ -409,6 +412,7 @@ ep_need_proxy_http (EProxy *proxy,
 				if (p_addr->type == PROXY_IPV6) {
 					if (IN6_ARE_ADDR_EQUAL (&net6, (struct in6_addr *) p_addr->addr)) {
 						d(g_print ("Host [%s] doesn't require proxy\n", host));
+						g_object_unref (addr);
 						return FALSE;
 					}
 				} else if (p_addr->type == PROXY_IPV6 &&
@@ -424,6 +428,7 @@ ep_need_proxy_http (EProxy *proxy,
 						| net6.s6_addr[15];
 					if ((v4addr & mask->s_addr) != addr_in->s_addr) {
 						d(g_print ("Host [%s] doesn't require proxy\n", host));
+						g_object_unref (addr);
 						return FALSE;
 					}
 				}
@@ -432,6 +437,8 @@ ep_need_proxy_http (EProxy *proxy,
 	}
 
 	d(g_print ("%s needs a proxy to connect to internet\n", host));
+	g_object_unref (addr);
+
 	return TRUE;
 }
 



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