summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2004-04-02 16:20:55 +0000
committerDan Winship <danw@src.gnome.org>2004-04-02 16:20:55 +0000
commit9c7a331f4775d88f53e0b19679de0c94f93f54db (patch)
tree126025f57ee6bd96bbb1338aafaa808829ac9b4e
parent5a7f5a49161ffdbc5ebd70df45a8d1d70bda0824 (diff)
downloadevolution-data-server-9c7a331f4775d88f53e0b19679de0c94f93f54db.tar.gz
Don't try to free the returned data if the method didn't actually return
* libedata-book/e-book-backend-sync.c (_e_book_backend_create_contact, _e_book_backend_remove_contacts, _e_book_backend_modify_contact, _e_book_backend_get_contact, _e_book_backend_get_supported_fields, _e_book_backend_get_supported_auth_methods): Don't try to free the returned data if the method didn't actually return anything
-rw-r--r--addressbook/ChangeLog11
-rw-r--r--addressbook/libedata-book/e-book-backend-sync.c30
2 files changed, 30 insertions, 11 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 579506230..2c4248b33 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,14 @@
+2004-04-02 Dan Winship <danw@ximian.com>
+
+ * libedata-book/e-book-backend-sync.c
+ (_e_book_backend_create_contact,
+ _e_book_backend_remove_contacts,
+ _e_book_backend_modify_contact,
+ _e_book_backend_get_contact,
+ _e_book_backend_get_supported_fields,
+ _e_book_backend_get_supported_auth_methods): Don't try to free the
+ returned data if the method didn't actually return anything
+
2004-04-02 JP Rosevear <jpr@ximian.com>
* backends/groupwise/Makefile.am: fix includes for builddir != srcdir
diff --git a/addressbook/libedata-book/e-book-backend-sync.c b/addressbook/libedata-book/e-book-backend-sync.c
index a6c666c52..0f6f5cf2a 100644
--- a/addressbook/libedata-book/e-book-backend-sync.c
+++ b/addressbook/libedata-book/e-book-backend-sync.c
@@ -194,13 +194,14 @@ _e_book_backend_create_contact (EBookBackend *backend,
const char *vcard)
{
EBookBackendSyncStatus status;
- EContact *contact;
+ EContact *contact = NULL;
status = e_book_backend_sync_create_contact (E_BOOK_BACKEND_SYNC (backend), book, vcard, &contact);
e_data_book_respond_create (book, status, contact);
- g_object_unref (contact);
+ if (contact)
+ g_object_unref (contact);
}
static void
@@ -215,7 +216,8 @@ _e_book_backend_remove_contacts (EBookBackend *backend,
e_data_book_respond_remove_contacts (book, status, ids);
- g_list_free (ids);
+ if (ids)
+ g_list_free (ids);
}
static void
@@ -224,13 +226,14 @@ _e_book_backend_modify_contact (EBookBackend *backend,
const char *vcard)
{
EBookBackendSyncStatus status;
- EContact *contact;
+ EContact *contact = NULL;
status = e_book_backend_sync_modify_contact (E_BOOK_BACKEND_SYNC (backend), book, vcard, &contact);
e_data_book_respond_modify (book, status, contact);
- g_object_unref (contact);
+ if (contact)
+ g_object_unref (contact);
}
static void
@@ -239,13 +242,14 @@ _e_book_backend_get_contact (EBookBackend *backend,
const char *id)
{
EBookBackendSyncStatus status;
- char *vcard;
+ char *vcard = NULL;
status = e_book_backend_sync_get_contact (E_BOOK_BACKEND_SYNC (backend), book, id, &vcard);
e_data_book_respond_get_contact (book, status, vcard);
- g_free (vcard);
+ if (vcard)
+ g_free (vcard);
}
static void
@@ -301,8 +305,10 @@ _e_book_backend_get_supported_fields (EBookBackend *backend,
e_data_book_respond_get_supported_fields (book, status, fields);
- g_list_foreach (fields, (GFunc)g_free, NULL);
- g_list_free (fields);
+ if (fields) {
+ g_list_foreach (fields, (GFunc)g_free, NULL);
+ g_list_free (fields);
+ }
}
static void
@@ -316,8 +322,10 @@ _e_book_backend_get_supported_auth_methods (EBookBackend *backend,
e_data_book_respond_get_supported_auth_methods (book, status, methods);
- g_list_foreach (methods, (GFunc)g_free, NULL);
- g_list_free (methods);
+ if (methods) {
+ g_list_foreach (methods, (GFunc)g_free, NULL);
+ g_list_free (methods);
+ }
}
static void