[evolution-patches] Re: Patch for #68264



Hi, Rodrigo:

	Ooops, sorry, my fault.  I append a patch.  I discovered also
two other memory leaks.

	Best regards,
	diego

On Fri, Nov 12, 2004 at 02:05:55PM +0100, Rodrigo Moya wrote:

| On Fri, 2004-11-12 at 13:50 +0100, Diego Sevilla Ruiz wrote:
| > Hi all. 
| > 
| > 	Attached is a fix for #68264.
| > 
| 
| > +        const char *uri_text = e_source_get_uri (t->source);
| > 
| e_source_get_uri returns a malloc'ed string, so you should not store it
| on a const, and you should also g_free it when no longer needed.
| 
| > +        if (strncmp (uri_text, "file:", 5))
| > +                return FALSE;
| > 
| this is wrong, it should be if (!strncmp (...
| 
| just those 2 changes and the patch will be ok.
| -- 
| Rodrigo Moya <rodrigo novell com>

-- 
Diego Sevilla Ruiz -- http://ditec.um.es/~dsevilla/ -- dsevilla um es _.___
Dep. Ingeniería y Tecnología de Computadores, Facultad de Informática D|TEC
Univ.de Murcia,Campus Espinardo,30080 Murcia (SPAIN),Tel.+34968367571
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/plugins/calendar-http/ChangeLog,v
retrieving revision 1.3
diff -u -r1.3 ChangeLog
--- ChangeLog	9 Nov 2004 13:32:39 -0000	1.3
+++ ChangeLog	12 Nov 2004 15:35:19 -0000
@@ -1,3 +1,10 @@
+2004-11-12  Diego Sevilla Ruiz  <dsevilla ditec um es>
+
+	* calendar-http.c (e_calendar_http_check): Accept protocol-less
+	URIs. Fixes #68264.
+	(e_calendar_http_check): Fixed a memory leak.
+	(e_calendar_http_refresh): Another mem. leak fix.
+
 2004-11-09  Rodney Dawes  <dobey novell com>
 
 	* Makefile.am: Add EXTRA_DIST variable for the eplug.in file
@@ -9,4 +16,3 @@
 2004-11-04  David Trowbridge <David Trowbridge Colorado edu>
 
 	* Initial import of webcal properties plugin.
-
Index: calendar-http.c
===================================================================
RCS file: /cvs/gnome/evolution/plugins/calendar-http/calendar-http.c,v
retrieving revision 1.1
diff -u -r1.1 calendar-http.c
--- calendar-http.c	4 Nov 2004 04:13:21 -0000	1.1
+++ calendar-http.c	12 Nov 2004 15:35:19 -0000
@@ -1,5 +1,5 @@
 /*
- * 
+ *
  *
  * Copyright (C) 2004 David Trowbridge
  *
@@ -218,6 +218,7 @@
 	ECalConfigTargetSource *t = (ECalConfigTargetSource *) data->target;
 	ESource *source = t->source;
 	EUri *uri;
+        char* uri_text;
 	static GtkWidget *hidden = NULL;
 
 	if (!hidden)
@@ -226,13 +227,16 @@
 	if (data->old)
 		gtk_widget_destroy (label);
 
-	uri = e_uri_new (e_source_get_uri (t->source));
+        uri_text = e_source_get_uri (t->source);
+	uri = e_uri_new (uri_text);
 	if ((strcmp (uri->protocol, "http") &&
 	     strcmp (uri->protocol, "webcal"))) {
 		e_uri_free (uri);
+                g_free (uri_text);
 		return hidden;
 	}
 	e_uri_free (uri);
+        g_free (uri_text);
 
 	parent = data->parent;
 
@@ -285,12 +289,24 @@
 	EUri *uri;
 	gboolean ok = FALSE;
 	ESourceGroup *group = e_source_peek_group (t->source);
+        char *uri_text;
 
 	if (strcmp (e_source_group_peek_base_uri (group), "webcal"))
 		return TRUE;
 
-	uri = e_uri_new (e_source_get_uri (t->source));
-	ok = ((!strcmp (uri->protocol, "webcal")) || (!strcmp (uri->protocol, "http")));
+        uri_text = e_source_get_uri (t->source);
+        if (!strncmp (uri_text, "file:", 5))
+        {
+                g_free (uri_text);
+                return FALSE;
+        }
+        
+	uri = e_uri_new (uri_text);
+	ok = ((!strcmp (uri->protocol, "webcal")) ||
+              (!strcmp (uri->protocol, "http")) ||
+              (!strcmp (uri->protocol, "file")) );
 	e_uri_free (uri);
+        g_free (uri_text);
+        
 	return ok;
 }


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