From e939da9df48b7e4992de4df915e7832803f8fa12 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Thu, 22 Feb 2001 21:40:26 +0000 Subject: Fixed memory corruption bug. 2001-02-22 Jeffrey Stedfast * openpgp-utils.c (openpgp_verify): Fixed memory corruption bug. * mail-format.c (try_inline_pgp_sig): Check to make sure the validity isn't NULL. (handle_multipart_signed): Check for NULL validities. 2001-02-21 Jeffrey Stedfast * mail-tools.c (mail_tool_uri_to_folder): Protect against NULL uri's. * mail-vtrash.c: Do mutex locking on the global hash table - this should clear up some segfaults ;-) * mail-config-druid.c (druid_finish): Set the 'enabled' member of the source to TRUE if the URL exists else set to FALSE. (incoming_type_changed): If the provider chosen is "None" then gray-out the auto-check widgets and the check-settings, otherwise sensitize them. * mail-account-editor.c (construct): Added a few more settings. (apply_changes): Save the new settings. * mail-config.c (service_copy): Updated. (config_read): Read in whether or not the account is enabled. (mail_config_write): Save if the account is enabled or not. svn path=/trunk/; revision=8349 --- mail/ChangeLog | 29 ++++++ mail/mail-account-editor.c | 21 ++++ mail/mail-account-editor.h | 12 ++- mail/mail-config-druid.c | 6 ++ mail/mail-config.c | 10 ++ mail/mail-config.glade | 238 ++++++++++++++++++++++++++++++++++++++++++++- mail/mail-config.h | 2 + mail/mail-format.c | 23 +++-- mail/mail-tools.c | 4 +- mail/mail-vtrash.c | 44 ++++++--- mail/openpgp-utils.c | 44 ++++++--- 11 files changed, 392 insertions(+), 41 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index ce4268018c..f38dbdf3a7 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,32 @@ +2001-02-22 Jeffrey Stedfast + + * openpgp-utils.c (openpgp_verify): Fixed memory corruption bug. + + * mail-format.c (try_inline_pgp_sig): Check to make sure the + validity isn't NULL. + (handle_multipart_signed): Check for NULL validities. + +2001-02-21 Jeffrey Stedfast + + * mail-tools.c (mail_tool_uri_to_folder): Protect against NULL + uri's. + + * mail-vtrash.c: Do mutex locking on the global hash table - this + should clear up some segfaults ;-) + + * mail-config-druid.c (druid_finish): Set the 'enabled' member of + the source to TRUE if the URL exists else set to FALSE. + (incoming_type_changed): If the provider chosen is "None" then + gray-out the auto-check widgets and the check-settings, otherwise + sensitize them. + + * mail-account-editor.c (construct): Added a few more settings. + (apply_changes): Save the new settings. + + * mail-config.c (service_copy): Updated. + (config_read): Read in whether or not the account is enabled. + (mail_config_write): Save if the account is enabled or not. + 2001-02-22 Jeffrey Stedfast * mail-ops.c (mail_send_message): Updated to reflect changes to diff --git a/mail/mail-account-editor.c b/mail/mail-account-editor.c index 5ce5db255b..526f0b57c2 100644 --- a/mail/mail-account-editor.c +++ b/mail/mail-account-editor.c @@ -197,6 +197,10 @@ apply_changes (MailAccountEditor *editor) account->source->save_passwd = GTK_TOGGLE_BUTTON (editor->save_passwd)->active; account->source->keep_on_server = GTK_TOGGLE_BUTTON (editor->keep_on_server)->active; + account->source->enabled = GTK_TOGGLE_BUTTON (editor->source_enabled)->active; + account->source->auto_check = GTK_TOGGLE_BUTTON (editor->source_auto_check)->active; + account->source->auto_check_time = gtk_spin_button_get_value_as_int (editor->source_auto_timeout); + if (editor->source_ssl) account->source->use_ssl = GTK_TOGGLE_BUTTON (editor->source_ssl)->active; @@ -541,6 +545,14 @@ transport_type_init (MailAccountEditor *editor, CamelURL *url) } } +static void +auto_check_toggled (GtkToggleButton *button, gpointer data) +{ + MailAccountEditor *editor = data; + + gtk_widget_set_sensitive (GTK_WIDGET (editor->source_auto_timeout), button->active); +} + static void source_check (MailAccountEditor *editor, CamelURL *url) { @@ -747,6 +759,15 @@ construct (MailAccountEditor *editor, const MailConfigAccount *account) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->source_ssl), account->source->use_ssl); editor->keep_on_server = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkKeepMailOnServer")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->keep_on_server), account->source->keep_on_server); + editor->source_auto_timeout = GTK_SPIN_BUTTON (glade_xml_get_widget (gui, "spinAutoCheckTimeout")); + gtk_spin_button_set_value (editor->source_auto_timeout, + (gfloat) (account->source->auto_check_time * 1.0)); + editor->source_auto_check = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkAutoCheckMail")); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->source_auto_check), account->source->auto_check); + gtk_signal_connect (GTK_OBJECT (editor->source_auto_check), "toggled", auto_check_toggled, editor); + gtk_widget_set_sensitive (GTK_WIDGET (editor->source_auto_timeout), account->source->auto_check); + editor->source_enabled = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkEnabled")); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->source_enabled), account->source->enabled); source_check (editor, url); source_auth_init (editor, url); if (url) diff --git a/mail/mail-account-editor.h b/mail/mail-account-editor.h index d9c318ea8d..a750bdedb6 100644 --- a/mail/mail-account-editor.h +++ b/mail/mail-account-editor.h @@ -46,6 +46,7 @@ struct _MailAccountEditor { GladeXML *gui; + /* Identity / General */ GtkEntry *account_name; GtkEntry *name; GtkEntry *email; @@ -53,6 +54,7 @@ struct _MailAccountEditor { GtkEntry *organization; GnomeFileEntry *signature; + /* Source */ GtkWidget *source_type; /* this is generic because we don't know the widget-type */ GtkEntry *source_host; GtkEntry *source_user; @@ -62,13 +64,19 @@ struct _MailAccountEditor { GtkOptionMenu *source_auth; GtkCheckButton *source_ssl; + GtkCheckButton *keep_on_server; + + GtkCheckButton *source_auto_check; + GtkSpinButton *source_auto_timeout; + + GtkCheckButton *source_enabled; + + /* Transport */ GtkWidget *transport_type; /* Same here... */ GtkEntry *transport_host; GtkOptionMenu *transport_auth; GtkCheckButton *transport_ssl; - GtkCheckButton *keep_on_server; - const CamelProvider *transport; }; diff --git a/mail/mail-config-druid.c b/mail/mail-config-druid.c index 8b9ae57019..58014c7430 100644 --- a/mail/mail-config-druid.c +++ b/mail/mail-config-druid.c @@ -217,8 +217,10 @@ druid_finish (GnomeDruidPage *page, gpointer arg1, gpointer user_data) mail_session_remember_password (source->url); } camel_url_free (url); + source->enabled = TRUE; } else { source->url = NULL; + source->enabled = FALSE; } /* construct the transport */ @@ -434,6 +436,10 @@ incoming_type_changed (GtkWidget *widget, gpointer user_data) druid->source_provider = provider; + gtk_widget_set_sensitive (GTK_WIDGET (druid->incoming_auto_check), provider ? TRUE : FALSE); + gtk_widget_set_sensitive (GTK_WIDGET (druid->incoming_auto_check_min), provider ? TRUE : FALSE); + gtk_widget_set_sensitive (GTK_WIDGET (druid->incoming_check_settings), provider ? TRUE : FALSE); + /* hostname */ label = glade_xml_get_widget (druid->gui, "lblSourceHost"); if (provider && provider->url_flags & CAMEL_URL_ALLOW_HOST) { diff --git a/mail/mail-config.c b/mail/mail-config.c index cdb98cd0f9..7817386cb7 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -102,6 +102,7 @@ service_copy (const MailConfigService *source) new->keep_on_server = source->keep_on_server; new->auto_check = source->auto_check; new->auto_check_time = source->auto_check_time; + new->enabled = source->enabled; new->save_passwd = source->save_passwd; new->use_ssl = source->use_ssl; @@ -274,6 +275,11 @@ config_read (void) if (source->auto_check && def) source->auto_check = FALSE; g_free (path); + path = g_strdup_printf ("source_enabled_%d", i); + source->enabled = gnome_config_get_bool_with_default (path, &def); + if (def) + source->enabled = TRUE; + g_free (path); path = g_strdup_printf ("source_save_passwd_%d", i); source->save_passwd = gnome_config_get_bool (path); g_free (path); @@ -389,6 +395,7 @@ mail_config_write (void) /* Accounts */ str = g_strdup_printf ("=%s/config/Mail=/Accounts/", evolution_dir); gnome_config_clean_section (str); + gnome_config_sync (); gnome_config_push_prefix (str); g_free (str); @@ -435,6 +442,9 @@ mail_config_write (void) path = g_strdup_printf ("source_auto_check_time_%d", i); gnome_config_set_int (path, account->source->auto_check_time); g_free (path); + path = g_strdup_printf ("source_enabled_%d", i); + gnome_config_set_bool (path, account->source->enabled); + g_free (path); path = g_strdup_printf ("source_save_passwd_%d", i); gnome_config_set_bool (path, account->source->save_passwd); g_free (path); diff --git a/mail/mail-config.glade b/mail/mail-config.glade index c30d6baba0..da0f2fc57b 100644 --- a/mail/mail-config.glade +++ b/mail/mail-config.glade @@ -2568,7 +2568,7 @@ SMTP GtkTable tableServerTimeouts - 3 + 5 10 True 0 @@ -2699,6 +2699,104 @@ SMTP False + + + GtkCheckButton + chkEnabled + True + + False + True + + 1 + 10 + 4 + 5 + 0 + 0 + False + False + False + False + True + False + + + + + GtkHBox + hbox40 + False + 0 + + 1 + 10 + 3 + 4 + 0 + 0 + False + True + False + False + True + True + + + + GtkCheckButton + chkAutoCheckMail + True + + False + True + + 0 + False + False + + + + + GtkSpinButton + spinAutoCheckTimeout + True + 1 + 0 + True + GTK_UPDATE_ALWAYS + False + False + 10 + 0 + 100 + 1 + 10 + 10 + + 0 + False + True + + + + + GtkLabel + lblMinutes + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + @@ -3120,4 +3218,142 @@ SMTP + + GnomeDialog + editor + False + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + True + False + True + True + False + False + + + GtkVBox + GnomeDialog:vbox + dialog-vbox4 + False + 8 + + 4 + True + True + + + + GtkHButtonBox + GnomeDialog:action_area + dialog-action_area4 + GTK_BUTTONBOX_END + 8 + 85 + 27 + 7 + 0 + + 0 + False + True + GTK_PACK_END + + + + GtkButton + button1 + True + True + GNOME_STOCK_BUTTON_OK + + + + GtkButton + button2 + True + True + GNOME_STOCK_BUTTON_APPLY + + + + GtkButton + button3 + True + True + GNOME_STOCK_BUTTON_CANCEL + + + + + GtkNotebook + toplevel + True + True + True + GTK_POS_TOP + False + 2 + 2 + False + + 0 + True + True + + + + Placeholder + + + + GtkLabel + Notebook:tab + lblGeneral + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + Placeholder + + + + GtkLabel + Notebook:tab + lblSource + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + Placeholder + + + + GtkLabel + Notebook:tab + lblTransport + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + + diff --git a/mail/mail-config.h b/mail/mail-config.h index ee9191a4c8..852049ccc0 100644 --- a/mail/mail-config.h +++ b/mail/mail-config.h @@ -44,6 +44,8 @@ typedef struct { gboolean keep_on_server; gboolean auto_check; gint auto_check_time; + gboolean enabled; + gboolean save_passwd; gboolean use_ssl; } MailConfigService; diff --git a/mail/mail-format.c b/mail/mail-format.c index 7517ac95bd..27849d54b7 100644 --- a/mail/mail-format.c +++ b/mail/mail-format.c @@ -119,7 +119,7 @@ add_url (char *url, gpointer data, MailDisplay *md) urls = g_datalist_get_data (md->data, "urls"); g_return_val_if_fail (urls != NULL, NULL); - + if (g_hash_table_lookup_extended (urls, url, &old_key, &old_value)) { g_free (url); url = old_key; @@ -1010,7 +1010,7 @@ try_inline_pgp_sig (char *start, MailDisplay *md) g_free (plaintext); /* Now display the "seal-of-authenticity" or something... */ - if (openpgp_validity_get_valid (valid)) { + if (valid && openpgp_validity_get_valid (valid)) { mail_html_write (md->html, md->stream, "
\n" "" @@ -1028,7 +1028,7 @@ try_inline_pgp_sig (char *start, MailDisplay *md) "not be proven to be authentic.")); } - if (openpgp_validity_get_description (valid)) { + if (valid && openpgp_validity_get_description (valid)) { mail_error_write (md->html, md->stream, openpgp_validity_get_description (valid)); mail_html_write (md->html, md->stream, "

"); @@ -1339,6 +1339,7 @@ handle_multipart_encrypted (CamelMimePart *part, const char *mime_type, CamelException ex; wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (part)); + g_return_val_if_fail (CAMEL_IS_MULTIPART (wrapper), FALSE); /* Currently we only handle RFC2015-style PGP encryption. */ @@ -1372,6 +1373,7 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type, int nparts, i; wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (part)); + g_return_val_if_fail (CAMEL_IS_MULTIPART (wrapper), FALSE); /* Currently we only handle RFC2015-style PGP signatures. */ @@ -1395,7 +1397,7 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type, } /* Now display the "seal-of-authenticity" or something... */ - if (openpgp_validity_get_valid (valid)) { + if (valid && openpgp_validity_get_valid (valid)) { mail_html_write (md->html, md->stream, "
\n
" "" @@ -1413,7 +1415,7 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type, "not be proven to be authentic.")); } - if (openpgp_validity_get_description (valid)) { + if (valid && openpgp_validity_get_description (valid)) { mail_error_write (md->html, md->stream, openpgp_validity_get_description (valid)); mail_html_write (md->html, md->stream, "

"); @@ -1441,6 +1443,7 @@ handle_multipart_related (CamelMimePart *part, const char *mime_type, int i, nparts; g_return_val_if_fail (CAMEL_IS_MULTIPART (wrapper), FALSE); + mp = CAMEL_MULTIPART (wrapper); nparts = camel_multipart_get_number (mp); @@ -1523,10 +1526,11 @@ handle_multipart_alternative (CamelMimePart *part, const char *mime_type, camel_medium_get_content_object (CAMEL_MEDIUM (part)); CamelMultipart *multipart; CamelMimePart *mime_part; - + g_return_val_if_fail (CAMEL_IS_MULTIPART (wrapper), FALSE); + multipart = CAMEL_MULTIPART (wrapper); - + mime_part = find_preferred_alternative (multipart, FALSE); if (mime_part) return call_handler_function (mime_part, md); @@ -1544,6 +1548,7 @@ handle_multipart_appledouble (CamelMimePart *part, const char *mime_type, CamelMultipart *multipart; g_return_val_if_fail (CAMEL_IS_MULTIPART (wrapper), FALSE); + multipart = CAMEL_MULTIPART (wrapper); /* The first part is application/applefile and is not useful @@ -1560,9 +1565,9 @@ handle_message_rfc822 (CamelMimePart *part, const char *mime_type, { CamelDataWrapper *wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (part)); - + g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (wrapper), FALSE); - + mail_html_write (md->html, md->stream, "
"); mail_format_mime_message (CAMEL_MIME_MESSAGE (wrapper), md); mail_html_write (md->html, md->stream, "
"); diff --git a/mail/mail-tools.c b/mail/mail-tools.c index 06efcd4a2f..ba457bd4cd 100644 --- a/mail/mail-tools.c +++ b/mail/mail-tools.c @@ -309,6 +309,8 @@ mail_tool_uri_to_folder (const char *uri, CamelException *ex) CamelStore *store = NULL; CamelFolder *folder = NULL; + g_return_val_if_fail (uri != NULL, NULL); + /* FIXME: This is a hack. */ if (!strncmp (uri, "vtrash:", 7)) { folder = vtrash_uri_to_folder (uri, ex); @@ -319,7 +321,7 @@ mail_tool_uri_to_folder (const char *uri, CamelException *ex) url = camel_url_new (uri, ex); if (!url) return NULL; - + if (!strcmp (url->protocol, "vfolder")) { folder = vfolder_uri_to_folder (uri, ex); } else { diff --git a/mail/mail-vtrash.c b/mail/mail-vtrash.c index 134ce558f5..ff76756e73 100644 --- a/mail/mail-vtrash.c +++ b/mail/mail-vtrash.c @@ -42,7 +42,11 @@ #define d(x) +#define VTRASH_LOCK(x) pthread_mutex_lock(&x) +#define VTRASH_UNLOCK(x) pthread_mutex_unlock(&x) + static GHashTable *vtrash_hash = NULL; +static pthread_mutex_t vtrash_hash_lock = PTHREAD_MUTEX_INITIALIZER; extern char *evolution_dir; extern CamelSession *session; @@ -51,17 +55,20 @@ extern CamelSession *session; CamelFolder * vtrash_uri_to_folder (const char *uri, CamelException *ex) { - CamelFolder *folder; + CamelFolder *folder = NULL; - if (!vtrash_hash) - return NULL; + g_return_val_if_fail (uri != NULL, NULL); if (strncmp (uri, "vtrash:", 7)) - return NULL; + return NULL; - folder = g_hash_table_lookup (vtrash_hash, uri); - - camel_object_ref (CAMEL_OBJECT (folder)); + VTRASH_LOCK (vtrash_hash_lock); + if (vtrash_hash) { + folder = g_hash_table_lookup (vtrash_hash, uri); + + camel_object_ref (CAMEL_OBJECT (folder)); + } + VTRASH_UNLOCK (vtrash_hash_lock); return folder; } @@ -76,9 +83,12 @@ vtrash_add (CamelStore *store, CamelFolder *folder, const char *store_uri, const uri = g_strdup_printf ("vtrash:%s", store_uri); + VTRASH_LOCK (vtrash_hash_lock); + if (!vtrash_hash) { vtrash_hash = g_hash_table_new (g_str_hash, g_str_equal); } else if (g_hash_table_lookup (vtrash_hash, uri) != NULL) { + VTRASH_UNLOCK (vtrash_hash_lock); g_free (uri); return; } @@ -90,6 +100,7 @@ vtrash_add (CamelStore *store, CamelFolder *folder, const char *store_uri, const } if (!storage) { + VTRASH_UNLOCK (vtrash_hash_lock); g_free (uri); return; } @@ -99,10 +110,12 @@ vtrash_add (CamelStore *store, CamelFolder *folder, const char *store_uri, const "mail", uri, name, FALSE); gtk_object_unref (GTK_OBJECT (storage)); + g_free (path); + g_hash_table_insert (vtrash_hash, uri, folder); camel_object_ref (CAMEL_OBJECT (folder)); - g_free (path); + VTRASH_UNLOCK (vtrash_hash_lock); } struct _get_trash_msg { @@ -138,7 +151,9 @@ create_trash_vfolder (const char *name, GPtrArray *urls, CamelException *ex) foldername = g_strdup ("mbox?(match-all (system-flag \"Deleted\"))"); /* we dont have indexing on vfolders */ - folder = mail_tool_get_folder_from_urlname (storeuri, foldername, CAMEL_STORE_FOLDER_CREATE|CAMEL_STORE_VEE_FOLDER_AUTO, ex); + folder = mail_tool_get_folder_from_urlname (storeuri, foldername, + CAMEL_STORE_FOLDER_CREATE | CAMEL_STORE_VEE_FOLDER_AUTO, + ex); g_free (foldername); g_free (storeuri); if (camel_exception_is_set (ex)) @@ -284,9 +299,12 @@ free_folder (gpointer key, gpointer value, gpointer data) void vtrash_cleanup (void) { - if (!vtrash_hash) - return; + VTRASH_LOCK (vtrash_hash_lock); + + if (vtrash_hash) { + g_hash_table_foreach (vtrash_hash, free_folder, NULL); + g_hash_table_destroy (vtrash_hash); + } - g_hash_table_foreach (vtrash_hash, free_folder, NULL); - g_hash_table_destroy (vtrash_hash); + VTRASH_UNLOCK (vtrash_hash_lock); } diff --git a/mail/openpgp-utils.c b/mail/openpgp-utils.c index 278dac0cdf..bb57036e60 100644 --- a/mail/openpgp-utils.c +++ b/mail/openpgp-utils.c @@ -1139,9 +1139,10 @@ openpgp_verify (const gchar *in, gint inlen, const gchar *sigin, gint siglen, Ca if (diagnostics) { char *charset; - char *desc; + const char *buf; + char *desc, *outbuf; iconv_t cd; - size_t len, inlen; + size_t len, outlen; charset = getenv ("CHARSET"); if (!charset) @@ -1149,14 +1150,18 @@ openpgp_verify (const gchar *in, gint inlen, const gchar *sigin, gint siglen, Ca cd = iconv_open ("UTF-8", charset); - inlen = strlen (diagnostics); - len = 2 * inlen; - desc = g_malloc0 (len); - if (iconv (cd, (const char **) &diagnostics, &inlen, &desc, &len) == -1) { + len = strlen (diagnostics); + outlen = 2 * len; + + outbuf = desc = g_malloc0 (outlen + 1); + buf = diagnostics; + if (cd == (iconv_t) -1 || iconv (cd, &buf, &len, &outbuf, &outlen) == -1) { g_free (desc); desc = g_strdup (diagnostics); } - iconv_close (cd); + + if (cd != (iconv_t) -1) + iconv_close (cd); openpgp_validity_set_description (valid, desc); g_free (desc); @@ -1174,13 +1179,19 @@ openpgp_verify (const gchar *in, gint inlen, const gchar *sigin, gint siglen, Ca PgpValidity * openpgp_validity_new (void) { - return g_new0 (PgpValidity, 1); + PgpValidity *validity; + + validity = g_new (PgpValidity, 1); + validity->valid = FALSE; + validity->description = NULL; + + return validity; } void openpgp_validity_init (PgpValidity *validity) { - g_return_if_fail (validity != NULL); + g_assert (validity != NULL); validity->valid = FALSE; validity->description = NULL; @@ -1189,7 +1200,8 @@ openpgp_validity_init (PgpValidity *validity) gboolean openpgp_validity_get_valid (PgpValidity *validity) { - g_return_val_if_fail (validity != NULL, FALSE); + if (validity == NULL) + return FALSE; return validity->valid; } @@ -1197,7 +1209,7 @@ openpgp_validity_get_valid (PgpValidity *validity) void openpgp_validity_set_valid (PgpValidity *validity, gboolean valid) { - g_return_if_fail (validity != NULL); + g_assert (validity != NULL); validity->valid = valid; } @@ -1205,7 +1217,8 @@ openpgp_validity_set_valid (PgpValidity *validity, gboolean valid) gchar * openpgp_validity_get_description (PgpValidity *validity) { - g_return_val_if_fail (validity != NULL, NULL); + if (validity == NULL) + return NULL; return validity->description; } @@ -1213,7 +1226,7 @@ openpgp_validity_get_description (PgpValidity *validity) void openpgp_validity_set_description (PgpValidity *validity, const gchar *description) { - g_return_if_fail (validity != NULL); + g_assert (validity != NULL); g_free (validity->description); validity->description = g_strdup (description); @@ -1222,7 +1235,7 @@ openpgp_validity_set_description (PgpValidity *validity, const gchar *descriptio void openpgp_validity_clear (PgpValidity *validity) { - g_return_if_fail (validity != NULL); + g_assert (validity != NULL); validity->valid = FALSE; g_free (validity->description); @@ -1232,7 +1245,8 @@ openpgp_validity_clear (PgpValidity *validity) void openpgp_validity_free (PgpValidity *validity) { - g_return_if_fail (validity != NULL); + if (validity == NULL) + return; g_free (validity->description); g_free (validity); -- cgit v1.2.3