[evolution-ews/gnome-3-20] Fix some issues found by Coverity Scan



commit 2399e2ad6ff575819dd5065afe755ce445833a81
Author: Milan Crha <mcrha redhat com>
Date:   Mon May 16 19:53:59 2016 +0200

    Fix some issues found by Coverity Scan

 src/addressbook/e-book-backend-ews.c |    2 +-
 src/camel/camel-ews-store.c          |    6 +++---
 src/server/e-ews-item.c              |    2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-ews.c b/src/addressbook/e-book-backend-ews.c
index 68cc469..0a754c6 100644
--- a/src/addressbook/e-book-backend-ews.c
+++ b/src/addressbook/e-book-backend-ews.c
@@ -3419,7 +3419,7 @@ e_book_backend_ews_start_view (EBookBackend *backend,
                return;
        }
 
-       for (l = mailboxes, c = contacts; l != NULL; l = g_slist_next (l), c = c ? g_slist_next (c) : NULL) {
+       for (l = mailboxes, c = contacts; l != NULL; l = g_slist_next (l), c = g_slist_next (c)) {
                EwsMailbox *mb = l->data;
                EEwsItem *contact_item = c ? c->data : NULL;
                EContact *contact = NULL;
diff --git a/src/camel/camel-ews-store.c b/src/camel/camel-ews-store.c
index d86667a..f9f0583 100644
--- a/src/camel/camel-ews-store.c
+++ b/src/camel/camel-ews-store.c
@@ -2801,11 +2801,11 @@ ews_rename_folder_sync (CamelStore *store,
 
        changekey = camel_ews_store_summary_get_change_key (ews_summary, fid, error);
        if (!changekey) {
-               g_free (fid);
                g_set_error (
                        error, CAMEL_STORE_ERROR,
                        CAMEL_STORE_ERROR_NO_FOLDER,
                        _("No change key record for folder %s"), fid);
+               g_free (fid);
                return FALSE;
        }
 
@@ -2848,7 +2848,6 @@ ews_rename_folder_sync (CamelStore *store,
                                error, CAMEL_STORE_ERROR,
                                CAMEL_STORE_ERROR_INVALID,
                                _("Cannot both rename and move a folder at the same time"));
-                       g_free (changekey);
                        goto out;
                }
 
@@ -2878,15 +2877,16 @@ ews_rename_folder_sync (CamelStore *store,
                        parent_name = g_strndup (new_name, new_slash - new_name - 1);
                        pfid = camel_ews_store_summary_get_folder_id_from_name (
                                ews_summary, parent_name);
-                       g_free (parent_name);
                        if (!pfid) {
                                g_set_error (
                                        error, CAMEL_STORE_ERROR,
                                        CAMEL_STORE_ERROR_NO_FOLDER,
                                        _("Cannot find folder ID for parent folder %s"),
                                        parent_name);
+                               g_free (parent_name);
                                goto out;
                        }
+                       g_free (parent_name);
                }
 
                res = e_ews_connection_move_folder_sync (
diff --git a/src/server/e-ews-item.c b/src/server/e-ews-item.c
index f73865d..e94d7d9 100644
--- a/src/server/e-ews-item.c
+++ b/src/server/e-ews-item.c
@@ -823,7 +823,7 @@ static gchar *
 strip_html_tags (const gchar *html_text)
 {
        gssize haystack_len = strlen (html_text);
-       gchar *plain_text = g_malloc (haystack_len);
+       gchar *plain_text = g_malloc (haystack_len + 1);
        gchar *start = g_strstr_len (html_text, haystack_len, "<body"),
                *end = g_strstr_len (html_text, haystack_len, "</body"),
                *i, *j;


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