[evolution-ews/gnome-3-8] 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/gnome-3-8] Bug #705658 - Fix errors found by CLANG - Avoid dereference of null pointer
- Date: Thu, 8 Aug 2013 15:15:21 +0000 (UTC)
commit 8a33d01b96c2981c6f6e709bdeb2b60fed3faf24
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 | 16 ++++++++++++----
src/camel/camel-ews-folder.c | 11 +++++++----
2 files changed, 19 insertions(+), 8 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-ews.c b/src/addressbook/e-book-backend-ews.c
index 9a7867b..22da43c 100644
--- a/src/addressbook/e-book-backend-ews.c
+++ b/src/addressbook/e-book-backend-ews.c
@@ -686,14 +686,22 @@ ebews_set_full_name_changes (ESoapMessage *message,
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);
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]