[evolution-ews] Address some of the static analyzers warnings
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews] Address some of the static analyzers warnings
- Date: Mon, 4 Apr 2022 14:02:34 +0000 (UTC)
commit 7765e6b84d938513dd8848b8b94d2103979b11f1
Author: Milan Crha <mcrha redhat com>
Date: Mon Apr 4 16:01:19 2022 +0200
Address some of the static analyzers warnings
src/EWS/addressbook/e-book-backend-ews.c | 2 ++
src/EWS/addressbook/ews-oab-decoder.c | 4 ++-
src/EWS/calendar/e-cal-backend-ews-utils.c | 1 +
src/EWS/camel/camel-ews-folder.c | 6 ++--
src/EWS/common/e-ews-calendar-utils.c | 2 +-
src/EWS/common/e-ews-connection.c | 18 +++++++++---
src/EWS/common/e-ews-item.c | 2 ++
src/EWS/evolution/e-ews-config-utils.c | 34 ++++++++++++----------
src/EWS/evolution/e-ews-subscribe-foreign-folder.c | 12 ++++++++
src/Microsoft365/addressbook/e-book-backend-m365.c | 2 +-
10 files changed, 57 insertions(+), 26 deletions(-)
---
diff --git a/src/EWS/addressbook/e-book-backend-ews.c b/src/EWS/addressbook/e-book-backend-ews.c
index bf10b850..e7c3c799 100644
--- a/src/EWS/addressbook/e-book-backend-ews.c
+++ b/src/EWS/addressbook/e-book-backend-ews.c
@@ -1635,6 +1635,8 @@ convert_indexed_contact_property_to_updatexml_physical_address (ESoapMessage *me
e_soap_message_end_element (message);
}
e_ews_message_end_set_indexed_item_field (message, delete_field);
+
+ g_free (fielduri);
}
static void
diff --git a/src/EWS/addressbook/ews-oab-decoder.c b/src/EWS/addressbook/ews-oab-decoder.c
index 9bc0e988..6913a034 100644
--- a/src/EWS/addressbook/ews-oab-decoder.c
+++ b/src/EWS/addressbook/ews-oab-decoder.c
@@ -1071,7 +1071,7 @@ gchar *
ews_oab_decoder_get_oab_prop_string (EwsOabDecoder *eod,
GError **error)
{
- GString *str = g_string_new (NULL);
+ GString *str;
GSList *l;
if (!eod->priv->oab_props) {
@@ -1081,6 +1081,8 @@ ews_oab_decoder_get_oab_prop_string (EwsOabDecoder *eod,
return NULL;
}
+ str = g_string_new (NULL);
+
/* Ideally i would liked to store int as int instead of converting to
* string, but sqlite db doesn't yet support storing keys as blob. */
for (l = eod->priv->oab_props; l != NULL; l = g_slist_next (l)) {
diff --git a/src/EWS/calendar/e-cal-backend-ews-utils.c b/src/EWS/calendar/e-cal-backend-ews-utils.c
index 5ea8a218..2e904223 100644
--- a/src/EWS/calendar/e-cal-backend-ews-utils.c
+++ b/src/EWS/calendar/e-cal-backend-ews-utils.c
@@ -1004,6 +1004,7 @@ e_ews_extract_attachment_id_from_uri (const gchar *uri)
attachment_id = g_strdup (dirs[n - 1]);
g_strfreev (dirs);
+ g_free (filepath);
return attachment_id;
}
diff --git a/src/EWS/camel/camel-ews-folder.c b/src/EWS/camel/camel-ews-folder.c
index 126fb36a..1a5c91b0 100644
--- a/src/EWS/camel/camel-ews-folder.c
+++ b/src/EWS/camel/camel-ews-folder.c
@@ -183,10 +183,10 @@ ews_data_cache_add (CamelDataCache *cdc,
cdc, path, g_checksum_get_string (sha), error);
g_checksum_free (sha);
- if (base_stream != NULL)
+ if (base_stream != NULL) {
stream = camel_stream_new (base_stream);
-
- g_object_unref (base_stream);
+ g_object_unref (base_stream);
+ }
return stream;
}
diff --git a/src/EWS/common/e-ews-calendar-utils.c b/src/EWS/common/e-ews-calendar-utils.c
index 864f5a80..82224b6a 100644
--- a/src/EWS/common/e-ews-calendar-utils.c
+++ b/src/EWS/common/e-ews-calendar-utils.c
@@ -1778,7 +1778,7 @@ e_ews_cal_utils_recurrence_to_rrule (EEwsItem *item,
}
if (usable) {
- if (recur_start && !i_cal_time_is_null_time (recur_start) && i_cal_time_is_valid_time
(recur_start)) {
+ if (!i_cal_time_is_null_time (recur_start) && i_cal_time_is_valid_time (recur_start)) {
ICalProperty *prop;
i_cal_component_set_dtstart (comp, recur_start);
diff --git a/src/EWS/common/e-ews-connection.c b/src/EWS/common/e-ews-connection.c
index dda96852..f7c26435 100644
--- a/src/EWS/common/e-ews-connection.c
+++ b/src/EWS/common/e-ews-connection.c
@@ -2098,11 +2098,13 @@ ews_connection_dispose (GObject *object)
e_ews_connection_set_password (cnc, NULL);
+ QUEUE_LOCK (cnc);
g_slist_free (cnc->priv->jobs);
cnc->priv->jobs = NULL;
g_slist_free (cnc->priv->active_job_queue);
cnc->priv->active_job_queue = NULL;
+ QUEUE_UNLOCK (cnc);
g_slist_free_full (cnc->priv->subscribed_folders, g_free);
cnc->priv->subscribed_folders = NULL;
@@ -3594,6 +3596,8 @@ autodiscover_srv_record_resolved_cb (GObject *source,
/* The callback also frees the 'simple' */
autodiscover_response_cb (NULL, ad->msgs[5], simple);
}
+
+ g_free (new_uri);
}
gboolean
@@ -3724,7 +3728,7 @@ e_ews_discover_prepare_messages_and_send (GSimpleAsyncResult *simple,
ad->msgs[3] = e_ews_get_msg_for_url (ad->cnc, url4, ad->buf, local_error ? NULL : &local_error);
ad->msgs[4] = e_ews_get_msg_for_url (ad->cnc, url5, ad->buf, local_error ? NULL : &local_error);
- if (!is_outlook && *domain && (ad->msgs[0] || ad->msgs[1] || ad->msgs[2] || ad->msgs[3] ||
ad->msgs[4])) {
+ if (!is_outlook && domain && (ad->msgs[0] || ad->msgs[1] || ad->msgs[2] || ad->msgs[3] ||
ad->msgs[4])) {
gchar *tmp;
tmp = g_strdup_printf ("http%s://%s/", use_secure ? "s" : "", domain);
@@ -8538,16 +8542,22 @@ ews_handle_free_busy_view (ESoapParameter *param,
ESoapParameter *dparam;
dparam = e_soap_parameter_get_first_child_by_name (subparam, "ID");
- if (dparam)
+ if (dparam) {
+ g_clear_pointer (&id, g_free);
id = e_soap_parameter_get_string_value (dparam);
+ }
dparam = e_soap_parameter_get_first_child_by_name (subparam, "Subject");
- if (dparam)
+ if (dparam) {
+ g_clear_pointer (&summary, g_free);
summary = e_soap_parameter_get_string_value (dparam);
+ }
dparam = e_soap_parameter_get_first_child_by_name (subparam, "Location");
- if (dparam)
+ if (dparam) {
+ g_clear_pointer (&location, g_free);
location = e_soap_parameter_get_string_value (dparam);
+ }
}
}
diff --git a/src/EWS/common/e-ews-item.c b/src/EWS/common/e-ews-item.c
index 9705523f..4bf3b2cb 100644
--- a/src/EWS/common/e-ews-item.c
+++ b/src/EWS/common/e-ews-item.c
@@ -2313,8 +2313,10 @@ e_ews_dump_file_attachment_from_soap_parameter (ESoapParameter *param,
param_name = e_soap_parameter_get_name (subparam);
if (g_ascii_strcasecmp (param_name, "Name") == 0) {
+ g_free (name);
name = e_soap_parameter_get_string_value (subparam);
} else if (g_ascii_strcasecmp (param_name, "Content") == 0) {
+ g_free (content);
value = e_soap_parameter_get_string_value (subparam);
content = g_base64_decode (value, &data_len);
g_free (value);
diff --git a/src/EWS/evolution/e-ews-config-utils.c b/src/EWS/evolution/e-ews-config-utils.c
index 75356e42..1699029f 100644
--- a/src/EWS/evolution/e-ews-config-utils.c
+++ b/src/EWS/evolution/e-ews-config-utils.c
@@ -1036,22 +1036,24 @@ action_folder_permissions_mail_cb (GtkAction *action,
service = CAMEL_SERVICE (store);
uid = camel_service_get_uid (service);
source = e_source_registry_ref_source (registry, uid);
- g_return_if_fail (source != NULL);
-
- settings = camel_service_ref_settings (service);
-
- e_ews_edit_folder_permissions (
- parent,
- registry,
- source,
- CAMEL_EWS_SETTINGS (settings),
- camel_service_get_display_name (service),
- folder_path ? folder_path : camel_service_get_display_name (service),
- folder_id,
- E_EWS_FOLDER_TYPE_MAILBOX);
-
- g_object_unref (settings);
- g_object_unref (source);
+ if (source) {
+ settings = camel_service_ref_settings (service);
+
+ e_ews_edit_folder_permissions (
+ parent,
+ registry,
+ source,
+ CAMEL_EWS_SETTINGS (settings),
+ camel_service_get_display_name (service),
+ folder_path ? folder_path : camel_service_get_display_name (service),
+ folder_id,
+ E_EWS_FOLDER_TYPE_MAILBOX);
+
+ g_object_unref (settings);
+ g_object_unref (source);
+ } else {
+ g_warn_if_reached ();
+ }
}
g_object_unref (store);
diff --git a/src/EWS/evolution/e-ews-subscribe-foreign-folder.c
b/src/EWS/evolution/e-ews-subscribe-foreign-folder.c
index 45263da6..ab31c99e 100644
--- a/src/EWS/evolution/e-ews-subscribe-foreign-folder.c
+++ b/src/EWS/evolution/e-ews-subscribe-foreign-folder.c
@@ -277,6 +277,18 @@ check_foreign_folder_thread (GObject *with_object,
g_object_unref (conn);
return;
}
+
+ if (!cffd->user_displayname)
+ cffd->user_displayname = display_name;
+ else
+ g_free (display_name);
+
+ if (email_address && *email_address) {
+ g_free (cffd->email);
+ cffd->email = email_address;
+ } else {
+ g_free (email_address);
+ }
}
if (g_cancellable_set_error_if_cancelled (cancellable, perror)) {
diff --git a/src/Microsoft365/addressbook/e-book-backend-m365.c
b/src/Microsoft365/addressbook/e-book-backend-m365.c
index 79fede80..30a43034 100644
--- a/src/Microsoft365/addressbook/e-book-backend-m365.c
+++ b/src/Microsoft365/addressbook/e-book-backend-m365.c
@@ -1077,7 +1077,7 @@ ebb_m365_contact_photo_equal (EContactPhoto *photo1,
if (!data1 && !data2)
return TRUE;
- return len1 == len2 &&
+ return len1 == len2 && data1 && data2 &&
memcmp (data1, data2, len1) == 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]