{
gchar *uri = (gchar*)user_data;
GSList *list_names_and_values = NULL;
-
+ gchar *to = NULL;
const gchar *cc = NULL;
const gchar *bcc = NULL;
const gchar *subject = NULL;
const gchar *body = NULL;
+ if (!check_and_offer_account_creation ()) {
+ goto cleanup;
+ }
/* Get the relevant items from the list: */
- gchar *to = uri_parse_mailto (uri, &list_names_and_values);
+ to = uri_parse_mailto (uri, &list_names_and_values);
GSList *list = list_names_and_values;
while (list) {
GSList *list_value = g_slist_next (list);
modest_ui_actions_compose_msg(NULL, to, cc, bcc, subject, body, NULL);
gdk_threads_leave (); /* CHECKED */
+cleanup:
/* Free the to: and the list, as required by uri_parse_mailto() */
g_free(to);
g_slist_foreach (list_names_and_values, (GFunc)g_free, NULL);
static gboolean
on_idle_compose_mail(gpointer user_data)
{
- if (!check_and_offer_account_creation ())
- return FALSE;
GSList *attachments = NULL;
ComposeMailIdleData *idle_data = (ComposeMailIdleData*)user_data;
+ if (!check_and_offer_account_creation ()) {
+ goto cleanup;
+ }
/* it seems Sketch at least sends a leading ',' -- take that into account,
* ie strip that ,*/
idle_data->bcc, idle_data->subject,
idle_data->body, attachments);
gdk_threads_leave (); /* CHECKED */
+cleanup:
g_slist_foreach(attachments, (GFunc)g_free, NULL);
g_slist_free(attachments);
+ g_free (idle_data->to);
+ g_free (idle_data->cc);
+ g_free (idle_data->bcc);
+ g_free (idle_data->subject);
+ g_free (idle_data->body);
+ g_free (idle_data->attachments);
+ g_free(idle_data);
return FALSE; /* Do not call this callback again. */
}