[evolution-ews] Bug 745457 - Crash under e_ews_notification_subscribe_folder_sync()



commit 57929319903ff268a03197e4afbe227987d38cde
Author: Milan Crha <mcrha redhat com>
Date:   Mon Mar 2 17:18:16 2015 +0100

    Bug 745457 - Crash under e_ews_notification_subscribe_folder_sync()

 src/server/e-ews-message.c      |    2 +-
 src/server/e-ews-notification.c |   21 ++++++++++++++++++---
 2 files changed, 19 insertions(+), 4 deletions(-)
---
diff --git a/src/server/e-ews-message.c b/src/server/e-ews-message.c
index b91aa3f..4e74fd1 100644
--- a/src/server/e-ews-message.c
+++ b/src/server/e-ews-message.c
@@ -101,7 +101,7 @@ e_ews_message_new_with_header (const gchar *uri,
        msg = e_soap_message_new (
                SOUP_METHOD_POST, uri, FALSE, NULL, NULL, NULL, standard_handlers);
        if (msg == NULL) {
-               g_warning (G_STRLOC ": Could not build SOAP message");
+               g_warning ("%s: Could not build SOAP message for uri '%s'", G_STRFUNC, uri);
                return NULL;
        }
 
diff --git a/src/server/e-ews-notification.c b/src/server/e-ews-notification.c
index 6e73ccf..c45ecb2 100644
--- a/src/server/e-ews-notification.c
+++ b/src/server/e-ews-notification.c
@@ -334,6 +334,11 @@ e_ews_notification_subscribe_folder_sync (EEwsNotification *notification,
                FALSE,
                FALSE);
 
+       if (!msg) {
+               g_warning ("%s: Failed to create Soup message for URI '%s'", G_STRFUNC, 
e_ews_connection_get_uri (notification->priv->connection));
+               return FALSE;
+       }
+
        e_soap_message_start_element (msg, "StreamingSubscriptionRequest", "messages", NULL);
 
        e_soap_message_start_element (msg, "FolderIds", NULL, NULL);
@@ -455,6 +460,11 @@ e_ews_notification_unsubscribe_folder_sync (EEwsNotification *notification,
                FALSE,
                FALSE);
 
+       if (!msg) {
+               g_warning ("%s: Failed to create Soup message for URI '%s'", G_STRFUNC, 
e_ews_connection_get_uri (notification->priv->connection));
+               return FALSE;
+       }
+
        e_ews_message_write_string_parameter_with_attribute (
                msg, "SubscriptionId", "messages", subscription_id, NULL, NULL);
 
@@ -713,9 +723,9 @@ e_ews_notification_get_events_sync (EEwsNotification *notification,
        gboolean ret;
        gulong handler_id;
 
-       g_return_val_if_fail (notification != NULL, SOUP_STATUS_CANCELLED);
-       g_return_val_if_fail (notification->priv != NULL, SOUP_STATUS_CANCELLED);
-       g_return_val_if_fail (notification->priv->connection != NULL, SOUP_STATUS_CANCELLED);
+       g_return_val_if_fail (notification != NULL, FALSE);
+       g_return_val_if_fail (notification->priv != NULL, FALSE);
+       g_return_val_if_fail (notification->priv->connection != NULL, FALSE);
 
        msg = e_ews_message_new_with_header (
                e_ews_connection_get_uri (notification->priv->connection),
@@ -728,6 +738,11 @@ e_ews_notification_get_events_sync (EEwsNotification *notification,
                FALSE,
                FALSE);
 
+       if (!msg) {
+               g_warning ("%s: Failed to create Soup message for URI '%s'", G_STRFUNC, 
e_ews_connection_get_uri (notification->priv->connection));
+               return FALSE;
+       }
+
        e_soap_message_start_element (msg, "SubscriptionIds", "messages", NULL);
        e_ews_message_write_string_parameter_with_attribute (msg, "SubscriptionId", NULL, subscription_id, 
NULL, NULL);
        e_soap_message_end_element (msg); /* SubscriptionIds */


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