Re: [evolution-patches] initial addressbook patches



On Fri, 2003-06-13 at 17:38, Chris Toshok wrote:
> This seems broken (you're checking *tempstr2 after it's been freed.)
> 
> probably want to move the g_frees up right after the ifs, so:
> 
> if (!tempstr2 || !*tempstr2) {
> 	g_free (tempstr2);
> 	g_object_get (...);
> }
> 
> and add a "g_free (tempstr2);" around the "g_free (tempstr);" at the end
> of that block.

Eeep.  Fixed version attached.

--Larry
Index: widgets/e-addressbook-util.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/e-addressbook-util.c,v
retrieving revision 1.25
diff -u -p -r1.25 e-addressbook-util.c
--- widgets/e-addressbook-util.c	10 Mar 2003 06:40:18 -0000	1.25
+++ widgets/e-addressbook-util.c	14 Jun 2003 01:16:19 -0000
@@ -525,6 +525,7 @@ e_addressbook_send_card_list (GList *car
 			tempstr = g_strdup_printf (_("VCard for %s"), file_as);
 			description = CORBA_string_dup (tempstr);
 			g_free (tempstr);
+			g_free (file_as);
 		}
 
 		show_inline = FALSE;
@@ -571,15 +572,17 @@ e_addressbook_send_card_list (GList *car
 			g_object_get(card,
 				     "file_as", &tempstr2,
 				     NULL);
-			if (!tempstr2 || !*tempstr2)
+			if (!tempstr2 || !*tempstr2) {
+				g_free (tempstr2);
 				g_object_get(card,
 					     "full_name", &tempstr2,
 					     NULL);
-			if (!tempstr2 || !*tempstr2)
+			} if (!tempstr2 || !*tempstr2) {
+				g_free (tempstr2);
 				g_object_get(card,
 					     "org", &tempstr2,
 					     NULL);
-			if (!tempstr2 || !*tempstr2) {
+			} if (!tempstr2 || !*tempstr2) {
 				EList *list;
 				EIterator *iterator;
 				g_object_get(card,
@@ -590,6 +593,7 @@ e_addressbook_send_card_list (GList *car
 					tempstr2 = e_iterator_get (iterator);
 				}
 				g_object_unref (iterator);
+				g_object_unref (list);
 			}
 
 			if (!tempstr2 || !*tempstr2)
@@ -597,6 +601,7 @@ e_addressbook_send_card_list (GList *car
 			else
 				tempstr = g_strdup_printf ("Contact information for %s", tempstr2);
 			subject = CORBA_string_dup (tempstr);
+			g_free (tempstr2);
 			g_free (tempstr);
 		}
 		


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