[evolution-ews] Bug #705658 - Fix errors found by CLANG - Avoid dereference of null pointer
- From: Fabiano Fidêncio <ffidencio src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews] Bug #705658 - Fix errors found by CLANG - Avoid dereference of null pointer
- Date: Thu, 8 Aug 2013 15:07:00 +0000 (UTC)
commit 677ef1effdf3f2fd3d431f0877f2db0229c7b085
Author: Fabiano Fidêncio <fidencio redhat com>
Date: Thu Aug 8 09:38:36 2013 +0200
Bug #705658 - Fix errors found by CLANG - Avoid dereference of null pointer
src/addressbook/e-book-backend-ews.c | 19 ++++++++++++++-----
src/camel/camel-ews-folder.c | 11 +++++++----
2 files changed, 21 insertions(+), 9 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-ews.c b/src/addressbook/e-book-backend-ews.c
index 81286af..032edb0 100644
--- a/src/addressbook/e-book-backend-ews.c
+++ b/src/addressbook/e-book-backend-ews.c
@@ -819,14 +819,22 @@ ebews_set_full_name_changes (EBookBackendEws *ebews,
name = e_contact_get (new, E_CONTACT_NAME);
old_name = e_contact_get (old, E_CONTACT_NAME);
- if (!name && !old_name)
+ if (!old_name && !name)
return;
- if (g_strcmp0 (name->given, old_name->given) != 0)
+ if (!old_name) {
convert_contact_property_to_updatexml (message, "GivenName", name->given, "contacts", NULL,
NULL);
-
- if (g_strcmp0 (name->additional, old_name->additional) != 0)
convert_contact_property_to_updatexml (message, "MiddleName", name->additional, "contacts",
NULL, NULL);
+ } else if (!name) {
+ convert_contact_property_to_updatexml (message, "GivenName", "", "contacts", NULL, NULL);
+
+ convert_contact_property_to_updatexml (message, "MiddleName", "", "contacts", NULL, NULL);
+ } else {
+ if (g_strcmp0 (name->given, old_name->given) != 0)
+ convert_contact_property_to_updatexml (message, "GivenName", name->given, "contacts",
NULL, NULL);
+ if (g_strcmp0 (name->additional, old_name->additional) != 0)
+ convert_contact_property_to_updatexml (message, "MiddleName", name->additional,
"contacts", NULL, NULL);
+ }
e_contact_name_free (name);
e_contact_name_free (old_name);
@@ -2663,9 +2671,10 @@ ebews_store_contact_items (EBookBackendEws *ebews,
for (l = new_items; l != NULL; l = g_slist_next (l)) {
EContact *contact;
- EEwsItem *item = l->data;
+ EEwsItem *item;
EVCardAttribute *attr;
+ item = l->data;
if (e_ews_item_get_item_type (item) == E_EWS_ITEM_TYPE_ERROR) {
g_object_unref (item);
continue;
diff --git a/src/camel/camel-ews-folder.c b/src/camel/camel-ews-folder.c
index ab45472..55a09a6 100644
--- a/src/camel/camel-ews-folder.c
+++ b/src/camel/camel-ews-folder.c
@@ -475,7 +475,7 @@ camel_ews_folder_get_message (CamelFolder *folder,
e_ews_item_get_item_type (items->data) == E_EWS_ITEM_TYPE_MEETING_MESSAGE ||
e_ews_item_get_item_type (items->data) == E_EWS_ITEM_TYPE_MEETING_RESPONSE) {
GSList *items_req = NULL;
- const EwsId *calendar_item_accept_id;
+ const EwsId *calendar_item_accept_id = NULL;
gboolean is_calendar_UID = TRUE;
// Get AssociatedCalendarItemId with second get_items call
@@ -498,9 +498,12 @@ camel_ews_folder_get_message (CamelFolder *folder,
}
goto exit;
}
- calendar_item_accept_id = e_ews_item_get_calendar_item_accept_id (items_req->data);
+
+ if (items_req != NULL)
+ calendar_item_accept_id = e_ews_item_get_calendar_item_accept_id (items_req->data);
+
/*In case of non-exchange based meetings invites the calendar backend have to create the
meeting*/
- if (!calendar_item_accept_id) {
+ if (calendar_item_accept_id == NULL) {
calendar_item_accept_id = e_ews_item_get_id (items->data);
is_calendar_UID = FALSE;
}
@@ -508,7 +511,7 @@ camel_ews_folder_get_message (CamelFolder *folder,
if (mime_fname_new)
mime_content = (const gchar *) mime_fname_new;
- if (items_req) {
+ if (items_req != NULL) {
g_object_unref (items_req->data);
g_slist_free (items_req);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]