Re: [evolution-patches] Patch for possible leaks in e-d-s
- From: Kjartan Maraas <kmaraas broadpark no>
- To: Sushma Rai <rsushma novell com>
- Cc: evolution-patches lists ximian com
- Subject: Re: [evolution-patches] Patch for possible leaks in e-d-s
- Date: Thu, 07 Jul 2005 11:18:32 +0200
ons, 06,.07.2005 kl. 11.33 +0530, skrev Sushma Rai:
> Yeah, having cleanup sections on error conditions
> would have been better..
>
> In this case, along with the filename, dirname is also getting
> leaked. Can you fix that and commit with the changelog?
>
Here's the updated patch with ChangeLog entries.
Cheers
Kjartan
Index: addressbook/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/addressbook/ChangeLog,v
retrieving revision 1.286
diff -u -p -r1.286 ChangeLog
--- addressbook/ChangeLog 6 Jul 2005 06:47:54 -0000 1.286
+++ addressbook/ChangeLog 7 Jul 2005 09:08:15 -0000
@@ -1,3 +1,9 @@
+2005-07-06 Kjartan Maraas <kmaraas gnome org>
+
+ * backends/file/e-book-backend-file.c:
+ (e_book_backend_file_load_source): Free filename and dirname
+ in the error cases.
+
2005-07-06 Sushma Rai <rsushma novell com>
* libedata-book/e-book-backend-cache.c
Index: addressbook/backends/file/e-book-backend-file.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/addressbook/backends/file/e-book-backend-file.c,v
retrieving revision 1.34
diff -u -p -r1.34 e-book-backend-file.c
--- addressbook/backends/file/e-book-backend-file.c 1 Jul 2005 05:17:00 -0000 1.34
+++ addressbook/backends/file/e-book-backend-file.c 7 Jul 2005 09:08:17 -0000
@@ -1056,6 +1056,8 @@ e_book_backend_file_load_source (EBookBa
db_error = e_db3_utils_maybe_recover (filename);
if (db_error != 0) {
g_warning ("db recovery failed with %d", db_error);
+ g_free (dirname);
+ g_free (filename);
return GNOME_Evolution_Addressbook_OtherError;
}
@@ -1068,6 +1070,8 @@ e_book_backend_file_load_source (EBookBa
if (db_error != 0) {
g_warning ("db_env_create failed with %d", db_error);
g_static_mutex_unlock(&global_env_lock);
+ g_free (dirname);
+ g_free (filename);
return GNOME_Evolution_Addressbook_OtherError;
}
@@ -1076,6 +1080,8 @@ e_book_backend_file_load_source (EBookBa
env->close(env, 0);
g_warning ("db_env_open failed with %d", db_error);
g_static_mutex_unlock(&global_env_lock);
+ g_free (dirname);
+ g_free (filename);
return GNOME_Evolution_Addressbook_OtherError;
}
@@ -1091,6 +1097,8 @@ e_book_backend_file_load_source (EBookBa
db_error = db_create (&db, env, 0);
if (db_error != 0) {
g_warning ("db_create failed with %d", db_error);
+ g_free (dirname);
+ g_free (filename);
return GNOME_Evolution_Addressbook_OtherError;
}
@@ -1101,6 +1109,8 @@ e_book_backend_file_load_source (EBookBa
if (db_error != 0) {
g_warning ("db format upgrade failed with %d", db_error);
+ g_free (dirname);
+ g_free (filename);
return GNOME_Evolution_Addressbook_OtherError;
}
@@ -1122,6 +1132,8 @@ e_book_backend_file_load_source (EBookBa
rv = e_util_mkdir_hier (dirname, 0777);
if (rv == -1 && errno != EEXIST) {
g_warning ("failed to make directory %s: %s", dirname, strerror (errno));
+ g_free (dirname);
+ g_free (filename);
if (errno == EACCES || errno == EPERM)
return GNOME_Evolution_Addressbook_PermissionDenied;
else
@@ -1148,6 +1160,8 @@ e_book_backend_file_load_source (EBookBa
if (db_error != 0) {
bf->priv->file_db = NULL;
+ g_free (dirname);
+ g_free (filename);
return GNOME_Evolution_Addressbook_OtherError;
}
@@ -1155,6 +1169,8 @@ e_book_backend_file_load_source (EBookBa
db->close (db, 0);
bf->priv->file_db = NULL;
g_warning ("e_book_backend_file_maybe_upgrade_db failed");
+ g_free (dirname);
+ g_free (filename);
return GNOME_Evolution_Addressbook_OtherError;
}
Index: libedataserverui/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/libedataserverui/ChangeLog,v
retrieving revision 1.47
diff -u -p -r1.47 ChangeLog
--- libedataserverui/ChangeLog 4 Jul 2005 03:35:35 -0000 1.47
+++ libedataserverui/ChangeLog 7 Jul 2005 09:08:51 -0000
@@ -1,3 +1,7 @@
+2005-07-06 Kjartan Maraas <kmaraas gnome org>
+
+ * e-source-option-menu.c: (populate): Fix a small leak.
+
2005-07-04 Sushma Rai <rsushma novell com>
* e-name-selector-entry.c: Setting COMPLETION_CUE_MIN_LEN to 3, to
Index: libedataserverui/e-source-option-menu.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/libedataserverui/e-source-option-menu.c,v
retrieving revision 1.6
diff -u -p -r1.6 e-source-option-menu.c
--- libedataserverui/e-source-option-menu.c 4 May 2005 08:43:58 -0000 1.6
+++ libedataserverui/e-source-option-menu.c 7 Jul 2005 09:08:51 -0000
@@ -138,6 +138,7 @@ populate (ESourceOptionMenu *option_menu
ESource *source = E_SOURCE (q->data);
char *label = g_strconcat (" ", e_source_peek_name (source), NULL);
GtkWidget *item = gtk_menu_item_new_with_label (label);
+ g_free (label);
gtk_object_set_data_full (GTK_OBJECT (item), MENU_ITEM_SOURCE_DATA_ID, source,
(GtkDestroyNotify) g_object_unref);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]